PDA

View Full Version : Need a little help with Excel macros /VB



i6s1
12-13-2002, 11:00 AM
OK, I don't know anything about VB. I need a helping hand.

I have recorded a macro in "book1" that opens up "book2", copys some data from book2, closes book2, pastes it to book1.

The problem is that when I close book2, I get a message that "there is a lot of info on the clipboard, do you want this info to be available to other programs?"

This crashes the macro.

I've tried copying from book2, switching back to book1, pasting, and then closing book2, but book1's filename changes, so I don't know switch the active book without using the filename.

The macro will only be run on a single computer so if there is a way to disable that clipboard message, that would work fine.

Workbooks.Open Filename:="C:\Dynamics\APP\book2.xls"
Range("B8:Z15").Select
Selection.Copy
ActiveWindow.Close 'This closes book2, book1 becomes active again. This is where the dialog box comes up.
Range("B8:Z15").Select
ActiveSheet.Paste


Thanks for any help. I will try to explain things better if this is not clear

ramazank2
12-21-2002, 11:33 PM
What may work is before closing the window go back to that window and double clicking on a random cell. This will get rid of the section that is copied so you wont get that message.

i6s1
12-23-2002, 02:12 PM
Thanks, I'll try that.

dbax791
12-24-2002, 09:42 PM
Yes, that might work. If it doesn't you can also copy one cell to the clipboard after pasting the large data. That will clear the big data from the clipboard.