View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default hWnd of UserForm

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

Function hWnd() As Long
Dim hWndThis As Long
If Val(Application.Version) 8 Then
hWndThis = FindWindow(lpClassName:="ThunderDFrame",
lpWindowName:=Me.Caption)
Else
hWndThis = FindWindow(lpClassName:="ThunderXFrame",
lpWindowName:=Me.Caption)
End If

hWnd = hWndThis
End Function


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"rsmith" wrote in message
...
If I activate a UserForm in Excel, how can I access
the hWnd of that UserForm ?