Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I haven't yet figured out a good strategy for keeping track of the name
of the original workbook after the user has switched to another one. For instance, in Book1.xls a macro might open Book2.xls, and if so, I want Book2's macro to re-activate Book1. But since Book1's original macro was in a menu, it could have been called when who-knows-what workbook was the active one. I've currently got the Book1's name hard-coded in Book2's macro, but that's a time bomb for anyone who later renames Book1. Using Personal.xls is not feasible with various users on a LAN. It's easy to use myOriginalBook = ActiveWorkbook.Name or whatever, to grab the name of Book1 when the Book1 is opened, but how can I store this string where it will still be available to Book2's macro? I was thinking of putting it in a Static variable in a subroutine that I call from both workbooks, but I can't call the subroutine from another workbook unless I spell out which workbook it's in, which means I have to know the workbook name I'm trying to find out. Same problem with storing it in a defined Name object in the original workbook, and probably same problem with using custom document properties (or using the registry(?) which seems too advanced for me). Is this as Catch-22 as I'm imagining it to be? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
usinig macros to copy from / to work books | Excel Discussion (Misc queries) | |||
How do I save a workbook as a new workbook by using macros? | Excel Discussion (Misc queries) | |||
Auto save replaced my original file and now I need the original? | Excel Discussion (Misc queries) | |||
Macros, Protected Books & Missing Passwords | Excel Worksheet Functions | |||
Books on writing Macros | Excel Discussion (Misc queries) |