Hello!
Drop this into the code section of your userform.
Code:
Option Explicit
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) 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 Type POINTAPI
x As Long
y As Long
End Type
Private Sub UserForm_Click()
Dim P As POINTAPI
Dim l As Long
l = GetCursorPos(P)
'PURPOSE: Grab the handle where ever the Pointer is residing
Dim lng_Handle As Long
lng_Handle = WindowFromPoint(P.x, P.y)
MsgBox "The handle for this object is: " & lng_Handle
'PURPOSE: Get the Class name
Dim strData As String * 128
l = GetClassName(lng_Handle, strData, Len(strData))
MsgBox "The classname for this object is: " & Left$(strData, l)
End Sub