Like the Class_Initialize constructor, there is also a destructor:
Sub Class_Terminate ... ' Put your destructor code here ' End Sub
This method is executed as soon as the reference count of this object reaches zero, i.e. when all the variables that reference this object are out of scope or have been configured for something else (for example, Nothing ). Thus, Set MyObject = Nothing will only call the destructor if MyObject is the last variable referencing this object.
Heinzi
source share