Unloading all open and hidden UserForms
Make use of the UserForms collection which will contain all your userforms,
hidden or not.
Try:
Sub UserFormUnload()
For a = 1 To UserForms.Count
Unload UserForms(0)
Next a
End Sub
The collection will re-index itself every time an object is deleted, so we
can repeatedly remove the first item - which has an index of '0'
Helpful? Click Yes.
"Ayo" wrote:
I am trying to figure out how to unload all hidden UserForms. I have about
7 UserForms but I use Me.Hide for all of them. At any point when I click the
cancel button on any of the UserForm I want all the open forms that are
hidden to be unloaded.
How do I go about doing this.
|