Releasing all Userforms in memory

  • Thread starter Thread starter Rich
  • Start date Start date
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.
 
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.
 

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

Back
Top