View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
lexcel lexcel is offline
external usenet poster
 
Posts: 34
Default Remove object from memory

I got it.
I am a bit ashamed as well.
But I didn't believe that VBA was so complex (to make our lives
simpler).
I added a Class_Terminate routine to MyClass and indeed, it was not
called as long as at least 1 pointer to the object survived.
So VBA inserts code that keeps track of the number of pointers to an
object and when that becomes 0 deletes the object. That implies that it
is up to VBA to remove the object from memory or not and the programmer
has no control over it.
But it makes the programmers life more simple, no worry about cleaning
up.

Anyway it is clear now what happens and everybody was right.

Thanks a lot.