View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Check if form is open

Use the FindWindow API

Using the FindWindow API call to get the Windows handle for an Excel
UserForm:


Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long


Then in your code do:


hWnd = FindWindow ("ThunderDFrame", Me.Caption)
If hWnd = 0 then

msgbox "Not found"

End if



Replace Me.Caption with the caption of the Userform you are searching for.

I believe in Excel 97, the class name is ThunderXFrame



--

Regards,

Tom Ogilvy









"Kev" wrote in message
...
Can someone help me out with this one?
I am trying to determine if an Excel form is open or not from within

Excel.
Thanks in advance.