Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Function FindWin(ByVal strName As String, Optional ByVal bClass As Boolean = False) As Long '按类名或者窗体名查找窗体
If bClass Then FindWin = FindWindow(strName, vbNullString) Else FindWin = FindWindow(vbNullString, strName) End IfEnd Function
For each frmtemp in Forms if frmtemp.name="你的窗体名字" MsgBox “已经存在!” next
Public Function FindWin(ByVal strName As String, Optional ByVal bClass As Boolean = False) As Long '按类名或者窗体名查找窗体
If bClass Then
FindWin = FindWindow(strName, vbNullString)
Else
FindWin = FindWindow(vbNullString, strName)
End IfEnd Function
if frmtemp.name="你的窗体名字"
MsgBox “已经存在!”
next