Hello,
I ignore the purpose of it, but here his what could be a start :
But this code on a commandbutton on your sheet :
Code:
Private Sub CommandButton5_Click()
EnumChildWindows Application.hwnd, AddressOf EnumChildProc, ByVal 0&
End Sub
and this code in a module :
Code:
Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim sSave As String
sSave = Space$(GetWindowTextLength(hwnd) + 1)
GetWindowText hwnd, sSave, Len(sSave)
sSave = Left$(sSave, Len(sSave) - 1)
If Trim(sSave) = "Ribbon" Then MsgBox sSave & " which has this hwnd : " & hwnd
EnumChildProc = 1
End Function
Launch and click : as you will see ===>> you will have an enumeration of all the present ribbons and their respective hwnd.
Start from tghatr.
The next step should probably be the identification of the Ribbon you are interested with.
The next would be trying to use the same method passing your ribbon's hwnd instead of application.hwnd
Bookmarks