Releasing all Userforms in memory

R

Rich

VBA provides methods to Hide (which keeps it in memory and
programmatically available) and Unload (which supposedly
removes all traces of the form until it's loaded again)
any given form.

But is there a way to unload any and all forms that are
presently in memory?

Thanks for any input.
 
T

Tom Ogilvy

Sub Tester1()
Dim frm As UserForm
Dim frm1 As UserForm1
Dim frm2 As UserForm1
Dim frm3 As UserForm1
Set frm1 = New UserForm1
Set frm2 = New UserForm1
Set frm3 = New UserForm1
Debug.Print UserForms.Count
For Each frm In UserForms
Unload frm
Next
Debug.Print UserForms.Count
End Sub


3
0

is the result.
 
Top