Check if UserForm is loaded?
Thanks, Peter, but once again: The Unload statement actually loads the
userform first before unloading it, if the userform is not loaded upon
calling the unload-statement, thus your solution cannot be used, since it is
important not to load the userform, because this sets off a chain of event,
which is not wanted when unloading it.
But, I really find it a lack of effencicy that that the unload statement
actually loads the userform first!!!
But, as said: I found a work around...
CE
"Peter T" wrote in message
...
I know you've worked around but for future reference try something like
this -
Sub UnloadAllForms()
Dim i As Long
For i = UserForms.Count To 1 Step -1
Unload UserForms(i - 1)
Next
End Sub
If a particular form is loaded you might want to run any clean up code
before unloading the form.
Regards,
Peter T
"Charlotte E" wrote in message
...
Hi,
I have a macro, which under some conditions load an UserForm, and under
other conditions don't.
And, on some of these conditions, the UserForm is only loaded, but not
shown (for extraction certain information)
To make sure, that I clean up my act, I have an Unload UserForm statement
at the very end of the macro.
But, for some weird obscure reason the Unload statement actually LOADS
the userform before unloading it!!!
So, my question is, how to test if the UserForm is already opened, so I
only Unload it, if it is open???
TIA,
|