Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA-Excel Disable Clipboard on close 1

Status
Not open for further replies.

vaneagle

Technical User
Apr 23, 2003
71
AU
Having issue with a macro where part of the process the macro copies data, and pastes into another file. No issue here. But when I go back to the source file and close the file it gives me the usual:

"There is a large amount of info on the clipboard. Do you want to be able to cut and paste this info into another program later?"

Is there something missing from the code below so that I can have the script say 'No'

ActiveWorkbook.Close

is there a better way to close the file so that it won't bring up the dialog box mention above???
 
Probably the easiest way is just to overwrite the clipboard with no data:


Code:
Sub TestClipBoardMsg()
   Dim JunkData     As New DataObject
Code:
'Put your code for copying and pasting here
   
   'Code to stop Clipboard message
Code:
   JunkData.SetText ""
   JunkData.PutInClipboard
End sub
 
Excellent!!!

Thanks very much for that...

Saves me having to click no for every file i close with the code....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top