LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Save original workbook name, referenced by macros in other books?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
usinig macros to copy from / to work books Steve Excel Discussion (Misc queries) 1 August 7th 09 02:33 AM
How do I save a workbook as a new workbook by using macros? KingKarl Excel Discussion (Misc queries) 4 November 10th 05 08:34 AM
Auto save replaced my original file and now I need the original? Hols Excel Discussion (Misc queries) 1 August 15th 05 10:34 PM
Macros, Protected Books & Missing Passwords jamesanddavid Excel Worksheet Functions 1 April 15th 05 05:45 PM
Books on writing Macros JC Excel Discussion (Misc queries) 1 January 29th 05 11:45 PM


All times are GMT +1. The time now is 10:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"