LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Zoo Zoo is offline
external usenet poster
 
Posts: 40
Default What's the difference between 'Set UserForm1=Nothing' and 'Unload UserForm1' ?

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
-------------------------
This means Unload statement creates a new instance of UserForm before
destroying it.
What makes the difference between Set and Unload?
Are there any other differences between those?


 
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
UserForm1 not getting removed using VBA Alok Excel Programming 1 January 4th 06 02:20 AM
Scrolling of UserForm1 frankosun Excel Programming 1 December 6th 05 08:09 PM
userform1.activecontrol.name Italian Job Excel Programming 3 November 14th 03 12:43 PM
Userform1 Border Tom Ogilvy Excel Programming 1 August 13th 03 03:14 PM
Userform1 Border John Wilson Excel Programming 0 August 12th 03 04:08 PM


All times are GMT +1. The time now is 02:08 AM.

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"