LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Ensure single class instance but with multiple references to it

Okay - Now I'm with you. That's why you commented about future lazy
programmers - they might set a reference to my Public x directly rather
than going through my class object (?). If that's the only concern
it's not so bad since I will distribute the code as an xla and make
that module private so it's only my own laziness that I have to watch
out for.

Re my obvious confusion over variable scope. My thinking was:

Set m_objMyNewRef = GetOpenServer() - GetOpenServer() - Set
m_objOpenServer = OpenServerClass object, Set GetOpenServer() =
m_objOpenServer
So now there is a pointer from m_objMyNewRef to m_objOpenServer and
from m_objOpenServer to the actual OpenServer class

Now when I do, Set m_objOpenServer = Nothing, m_objMyNewRef is still
pointing to m_objOpenServer (or so I thought) so m_objOpenServer
wouldn't be destroyed. It seems the reference though is direcly from
m_objMyNewRef to the OpenServer class.

As I write this I've remembered something along these lines in the vba
developers handbook - will have to read again tonight. Caught out by
my own wishful thinking...

Once again thanks - I will go with your proposed solution.

Best Regards,
Andrew



 
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
Single Excel instance with multiple windows BrianB Excel Discussion (Misc queries) 0 March 2nd 10 06:41 PM
run a single instance of excel Teamlevy Excel Discussion (Misc queries) 8 December 4th 08 04:31 PM
Userform level class instance doesn't recognize methods =Ray= Excel Programming 2 December 16th 05 05:58 PM
Class Instance Identifier Chip Pearson Excel Programming 6 June 29th 04 09:34 AM
Excel Single Instance Doug Nichol Excel Programming 3 December 12th 03 10:45 PM


All times are GMT +1. The time now is 06:14 PM.

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"