View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
PeteCresswell[_2_] PeteCresswell[_2_] is offline
external usenet poster
 
Posts: 56
Default Globals Go "Poof!": Workarounds?

On May 22, 10:04 pm, Dave Peterson wrote:
First, if all you're doing is saving the workbook's name and its path, you could
use something like:

Thisworkbook.name
Thisworkbook.fullname
Thisworkbook.path


I should have mentioned this in the OP: problem is that when a user
double-clicks a .XLS, Windows has this nasty habit of opening up
the .XLS in whatever instance of Excel already happens tb running.

Hence, at any given time "ThisWorkBook" could be something besides the
one I'm working in. Also, some of my routines open up "Temp"
spreadsheets and copy worksheets from them into my "Real" workbook.

Bottom line is that I want (need?) to make all my object references
explicit - by name - instead of by number. e.g.
".WorkBooks("Whatever") instead of ".WorkBooks(2)".

I'm pretty sure the business of opening into an existing Excel
instance could be altered via some registry entry or another.... but I
want this thing tb portable without any OS customization.

So I'm back to the question of whether squirreling away those intially-
acquired values in an invisible "System" worksheet is good practice.

Haven't seen anything to the contrary. Once I get on top of some
other issues I'll go that route if nobody gives a reason not to.