OK, here's what I want you to do.
1. Open a new Excel Workbook.
2. Add a Userform
3. Add a Textbox to the userform called "TextBox1"
4. Put this code onto the userform:
<pre>
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
'Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String)
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
Private Sub UserForm_Initialize()
Dim lpClassName As String
Dim hwnd As Long, lresult As Long
lpClassName = Space(256)
hwnd = FindWindow(vbNullString, Me.Caption)
lresult = GetClassName(hwnd, lpClassName, 256)
txtClassname = Left$(lpClassName, lresult)
Me.Textbox1.Text = txtClassname
End Sub</pre>
5. Run the userform. Hopefully the Textbox will say something other than "ThunderDForm"
6. In the code I gave you before, put this code in in place of hte "If...Then" statement which compares the Application Version numbers. Change the "Case Else" part of this code that says "TextBox1's Contents" to whatever the text is in TextBox1.
<pre>
Select Case Val(Application.Version)
Case 8
hWndForm = FindWindow("ThunderXFrame", Me.Caption) 'XL97
Case 9
hWndForm = FindWindow("ThunderDFrame", Me.Caption) 'XL2000
Case Else
hWndForm = FindWindow("TextBox1's Contents", Me.Caption) 'XL2000
End Select</pre>
7. Tell me the name that is in TextBox1 because I don't have Office XP and I am interested to find out what the Userform ClassName is now.
HTH