![]() |
Unloading A Form
How can I check if a form is loaded or not? Reason for wanting to do this: I have a button on a worksheet which displays a form. I use form.show to do this. It takes a long time to load as there is a lot to do in the initialization. There is a button the on form that says "exit" but it only hides the form. If the user then clicks the worksheet button again the form is displayed very fast as it only has to be unhidden. There is one condition which can happen which would mean I want to unload the form. If I use unload.form and the form is loaded and either hidden or not, it unloads fast. If it is not loaded it then loads (which takes AGES) then unloads. I would like to only unload it if it is loaded but cannot work out how to do check. TIA. Chrissy |
Unloading A Form
Use the Userform collection
I had two userforms, each with one button that hides the userform: (as an example) Sub ShowForm() UserForm1.Show UserForm2.Show For Each frm In UserForms MsgBox frm.Name Next MsgBox UserForms.Count Unload UserForm1 Unload UserForm2 End Sub -- Regards, Tom Ogilvy "Chrissy" wrote in message ... How can I check if a form is loaded or not? Reason for wanting to do this: I have a button on a worksheet which displays a form. I use form.show to do this. It takes a long time to load as there is a lot to do in the initialization. There is a button the on form that says "exit" but it only hides the form. If the user then clicks the worksheet button again the form is displayed very fast as it only has to be unhidden. There is one condition which can happen which would mean I want to unload the form. If I use unload.form and the form is loaded and either hidden or not, it unloads fast. If it is not loaded it then loads (which takes AGES) then unloads. I would like to only unload it if it is loaded but cannot work out how to do check. TIA. Chrissy |
All times are GMT +1. The time now is 08:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com