Public Function have_form(mdifm As MDIForm) As Boolean Dim actfm As Form Set actfm = mdifm.ActiveForm If actfm Is Nothing Then have_form = False child_reg = False Else have_form = True End If End Function
If App.PrevInstance = True Then MsgBox "有程序运行" End If
用Forms这个内置全局对象集合. dim f for each f in forms if f.namd ="你要找的窗体" then msgbox "给分吧!" end if next
Dim actfm As Form
Set actfm = mdifm.ActiveForm
If actfm Is Nothing Then
have_form = False
child_reg = False
Else
have_form = True
End If
End Function
MsgBox "有程序运行"
End If
dim f
for each f in forms
if f.namd ="你要找的窗体" then
msgbox "给分吧!"
end if
next