PDA

View Full Version : Solved: Detect if a form is opened



JKwan
05-30-2007, 06:44 AM
if I issue this VBA

userform1.show


Later on, if I wanted to check if the userform1 is displayed or not, how do I check if it is opened?

Thanks

mikerickson
05-30-2007, 06:55 AM
With UserForm1
If .ActiveControl Is Nothing Then MsgBox "Userform not loaded"
If Not (.ActiveControl Is Nothing) And Not (.Visible) Then MsgBox "Userform Hidden"
If Not (.ActiveControl Is Nothing) And .Visible Then MsgBox "Userform on screen"
End With

Bob Phillips
05-30-2007, 07:40 AM
For Each frm In UserForms
If frm.Name = "UserForm1" Then
MsgBox "loaded"
Exit For
End If
Next frm