unload userforms

R

Ram6

Hi Daren,

I think this code can be de answer to your question. Loop the UserForms
collection and close each userform one by one (but quick of course :)

Sub UnloadForms()
Dim i As Integer
Dim strClose As String

'Loop the userforms collection to close each active user form

For i = VBA.UserForms.Count - 1 To 0 Step -1

strClose = strClose & VBA.UserForms(i).Name & vbCr

Unload VBA.UserForms(i)
Next

MsgBox strClose & "Closed"

End Sub

Hope it will help you.

Kind Regards,
Ramses
 
D

daren white

Thank you - it works a treat

Ram6 said:
Hi Daren,

I think this code can be de answer to your question. Loop the UserForms
collection and close each userform one by one (but quick of course :)

Sub UnloadForms()
Dim i As Integer
Dim strClose As String

'Loop the userforms collection to close each active user form

For i = VBA.UserForms.Count - 1 To 0 Step -1

strClose = strClose & VBA.UserForms(i).Name & vbCr

Unload VBA.UserForms(i)
Next

MsgBox strClose & "Closed"

End Sub

Hope it will help you.

Kind Regards,
Ramses
 

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