Linking Workbooks via Macros question


Posted by Joe on November 03, 2001 5:31 AM

What a great message board! I hope someone here can help me...

I need a command that recognizes whatever workbook I have open, instead of a specific workbook.

For example I want to copy something from Book 2 to Book 1 like so:

Windows("Book2").Activate
Selection.Copy
Windows("Book1").Activate

Now, say next time I have Book 3 open and I want to copy the same info to Book1. Book1 being the constant.

Well you can see my problem. The macro only recognizes Book2. What can I put in place of my Book2 command so that it will recognize whatever workbook I have open? Is there a way to do that?

Any help would be appreciated!

Posted by Ivan F Moala on November 03, 2001 8:14 AM


If ActiveWorkbook.Name = ThisWorkbook.Name Then ActiveWindow.ActivateNext

Ivan



Posted by Joe on November 03, 2001 10:26 AM

Ivan! Thanks. That was exactly what I was looking for. You've saved me alot of grief.

You da man!