What's the difference between 'Set UserForm1=Nothing' and 'Unload UserForm1' ?

Z

Zoo

I have 'UserForm1' and Module1.
In UserForm1:

Private Sub UserForm_Initialize()
Debug.Print "Initialized"
End Sub

Private Sub UserForm_Terminate()
Debug.Print "Terminated"
End Sub

In Module1:

Sub Main()

Debug.Print "Set UserForm1 to nothing"
Set UserForm1 = Nothing

Debug.Print

Debug.Print "Unload UserForm1"
Unload UserForm1

End Sub

After running 'Main', the result is:
-------------------------
Set UserForm1 to nothing

Unload UserForm1
Initialized
Terminated
 
W

Wendell A. Clark

setting an object to nothing returns the memory....

--
Wendell A. Clark, BS
-------------------------------------

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may
contain confidential and privileged information for the use of the
designated recipients named above. If you are not the intended recipient,
please notify us by reply e-mail. You are hereby notified that you have
received this communication in error and that any review, disclosure,
dissemination, distribution or copying of it or its contents is prohibited.
If you have received this communication in error, please destroy all copies
of this communication and any attachments. Contact the sender if it
continues.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top