Unloading Every Userform In A Workbook


Posted by George Clements on June 01, 2001 9:27 AM

Hello

I wonder if anyone can help. I have a workbook with 14 userforms. I want to make sure each userform is unloaded when the workbook is closed. How do I do this without referring to each userform by name. I have tried the following but this doesn't work:

for each uf in activeworkbook.userform
unload uf
next uf

Any help would be much appreciated

Thank you

George Clements

Posted by Dax on June 01, 2001 9:35 AM


Hi,

Try this: -

Sub RemoveForms()
Dim frm As UserForm
For Each frm In UserForms
Unload frm
Next
End Sub

Regards,
Dax.



Posted by George Clements on June 01, 2001 11:55 AM

Thanks Dax