PDA

View Full Version : Workbook Reference



Heim
02-18-2008, 05:01 AM
Hi all,

First post here, hoping someone can give me a hand. Ive just finished creating a macro that will create a new workbook and copy relative data over and make it look pretty. I then find out my boss will be renaming the first workbook on a regular basis!!. My code relies on referencing to the original workbook when it comes to copying.

Is there anyway of creating a variable that will refer to the first workbook? Or some way or referencing to the first workbook without actually using its name?

Thanks

Heim
02-18-2008, 05:11 AM
ooo actually if I just refer to it as Workbooks(1), will the index take into account another Excel documents opened before the one in question? Or will the macro always refer to the Workbook its in to be number 1 on the index?

Bob Phillips
02-18-2008, 06:07 AM
You can never relyt on the workbook that you want being workbook 1,2, 3 or anything else.

Somewhere you must open it, how do you know what it is called at that point?

Heim
02-18-2008, 06:29 AM
Thats for the reply xld but I have solved the problem now :)