View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default Testing if Userform loaded

Thanks - works a treat

--
Cheers
Nigel



"Peter T" <peter_t@discussions wrote in message
...
Just to add, if unloading forms loop like this

If UserForms.Count 0 Then
For i = UserForms.Count - 1 To 0
Unload UserForms(i)

Peter T


"Peter T" <peter_t@discussions wrote in message
...
' for testing
' x = UserForm2.Caption ' loads if not already

If UserForms.Count 0 Then
For i = 0 To UserForms.Count - 1
Debug.Print UserForms(i).Caption, UserForms(i).Visible
Next
End If

You could unload forms in the loop if necessary.

Regards,
Peter T

"Nigel" wrote in message
...
Hi
Thanks for the suggestion, in this case I think it will work. But I
may
have more than one form and wanted something to test for a specific
form
being in memory. Possible?

something like

If userform1.loaded then
do what i need to do
End If

--
Cheers
Nigel



"Peter T" <peter_t@discussions wrote in message
...
Hi Nigel,

If UserForms.Count = 0 Then
MsgBox "no forms are loaded"
End If

Regards,
Peter T

"Nigel" wrote in message
...
Hi All
How can I test if a userform is loaded in memory?

I have a userform that can be loaded and not visible or just not

loaded.
Before I manipulate the controls on the form I need to determine if

it
is
memory.

Thank You

--
Cheers
Nigel