Large Amount of Info on Clipboard

B

Bill Martin

Using Excel 2003 I recorded a macro that opens a second file, copies a large
amount of data from it that gets pasted into the original file, then closes this
second file. I've used this code as a base to do what I actually want.

My problem is when the code closes the second file with:
ActiveWindow.Close Savechanges:=False

At that point Excel comes to a halt with a message window telling me that
there's a large amount of data on the clipboard, and do I want to save it? How
do I get VBA to tell it 'no' without this message window coming up?

Thanks.

Bill
 
D

Dave Peterson

Try:

application.cutcopymode = false
activewindow.close savechanges:=false

(I'd use a variable for the workbook. I don't trust the windows collection.)

application.cutcopymode = false
activeworkbook.close savechanges:=false
'or
wkbk.close savechanges:=false
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top