Consulting

Results 1 to 4 of 4

Thread: Getting rid of a popup on closing a workbook

  1. #1
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location

    Getting rid of a popup on closing a workbook

    So I have some code which closes a workbook, from which I've just copied some data....

    Windows(aWB).Close False
    However as soon as the code does this, a message box pops up, kindly informing the user that they "... have placed a large amount of data on the clipboard...."

    How do I stop this warning appearing (and set the default option to no, so that the data is dropped from the clipboard?

    Cheers
    Last edited by Aussiebear; 04-06-2023 at 08:31 PM. Reason: Adjusted the code tags

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Application.CutCopyMode = False should empty the clipboard
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    I've already got that, and it isn't working:
    Range("A1:J" & oldRowCount).Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Report.xls").Activate
    Sheets("Totals").Select
    Range("A1").Select
    ActiveSheet.Paste
    ActiveSheet.Columns("A:J").AutoFit
    ' close the data workbook
    Windows(aWB).Close False
    Edit:
    got it, by moving the code

    Range("A1:J" & oldRowCount).Select
    Selection.Copy
    Windows("Report.xls").Activate
    Sheets("Totals").Select
    Range("A1").Select
    ActiveSheet.Paste
    ActiveSheet.Columns("A:J").AutoFit
    Application.CutCopyMode = False
    ' close the data workbook
    Windows(aWB).Close False
    Last edited by Aussiebear; 04-06-2023 at 08:30 PM. Reason: Adjusted the code tags

  4. #4
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,199
    Location
    Application.CutCopyMode = False should be after the paste.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2403, Build 17425.20146

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •