Expression to keep/clear clipboard after Workbooks().close

vbacoder

Active Member
Joined
Jul 7, 2007
Messages
354
Hi everyone,

I've written some VBA code to copy data from a series of seperate CSVs and apend in a single XL sheet. Rather than leaving the files from which I am copying data open, I would like to close these after pasting in the target file, and I try to do this using:

Workbooks("ExampleFileName.csv").Close SaveChanges:=False

However, before the file closes, a pop-up appears asking if data in the clipboard should be cleared or retained. Please could someone advise me on the way to either retain or clear the data in the clipboard after closing the source file?

vcoder
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
To clear the clipboard and avoid the message

Code:
Application.CutCopyMode = False
 
Upvote 0
You can probably just use

Application.DisplayAlerts = False

prior to calling the Close method if you want to retain the data on the clipboard as "Yes" is the default answer to the clipboard data question.
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top