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: 134
Default Nothing Keyword Destories Objects rather than just resetting the variable to an empty variable

Office XP, SP3 (VBA 6.0)
WIN XP, SP2


I have read over the text dealing with custom objects

According to the text that I have read online from MS themselves, the
keyword "NOTHING" should only destroy the object when there is no other
variable refering to that object. However, as I have learned the hard way,
that is not the case. Any time any variable is set to NOTHING, the object
is destroyed, so any object variable referencing to that object is then also
set to NOTHING.

Example:

PayCode collection has a set of objects containing properties. One of those
PayCode objects is passed onto an Employee Object. It's passed into the
employee object via a property with the object using the ByRef within the
signature line, so if there's any changes to the PayCode object, it's not
only changed within the PayCodes collection, but also within the Employee's
PayCode reference to it.

However, if the Employee Object is set to be destroyed, via the clean up
code, the code should be to set the object variable within the Employee
Object to NOTHING. However, doing that not only does that, but also set's
that particular object within the PayCodes collection to NOTHING as if the
object itself has been destroyed.

How do I resolve this issue, so as I can have it reset only the variable,
not destroy the actual object, but yet, also allow for changes to carry into
the variable when they are done into the main object?

--
Thanks,

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000


 
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
Dimmed Keyword as Variable Zone Excel Programming 1 December 15th 06 09:38 PM
If Range Variable isn't Empty achidsey Excel Programming 3 October 19th 05 07:15 PM
assign objects into array or object variable? Fendic[_12_] Excel Programming 1 July 22nd 05 09:23 PM
empty variable range S1 Excel Discussion (Misc queries) 5 January 28th 05 02:33 PM
Resetting a variable to nothing Todd Huttenstine[_3_] Excel Programming 4 January 27th 04 12:06 PM


All times are GMT +1. The time now is 05:15 AM.

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

About Us

"It's about Microsoft Excel"