I have an Excel workbook, which using VBA code that opens another workbook, copies some data into the original, then closes the second workbook.
When I close the second workbook (using Application.Close
), I get a prompt for:
Do you want to save the clipboard.
Is there a command in VBA which will bypass this prompt?
If you don't want to save any changes and don't want that Save prompt while saving an Excel file using Macro then this piece of code may helpful for you
Because the
Saved
property is set toTrue
, Excel responds as though the workbook has already been saved and no changes have occurred since that last save, so no Save prompt.If I may add one more solution: you can simply cancel the clipboard with this command:
Just clear the clipboard before closing.
I have hit this problem in the past - from the look of it if you don't actually need the clipboard at the point that you exit, so you can use the same simple solution I had. Just clear the clipboard. :)
Chris
I can offer two options
Based on your description I'm guessing you are doing something like
If this is the case, you don't need to copy via the clipboard. This method copies from source to destination directly. No data in clipboard = no prompt
You can prevent all alert pop-ups by setting
[Edit]
proposed solution edit works if you replace the row
with