hi and tks again
would you say that if in your 2007 run this procedure, you get error and not see anything of debug print?
Code:
Function MenuPopupX()
Dim CBR As CommandBar
Dim lngIDX As Long
For Each CBR In Application.CommandBars
If CBR.Type = msoBarTypePopup Then
x = x + 1 ' only to print first x menù
Debug.Print "0 (" & CBR.Index & ") Menù=" & CBR.Name & " "
ControlCommandBar CBR, , lngIDX
Debug.Print vbNewLine
End If
If x = 5 Then Exit Function ' only to print first x menù
Next
End Function
Function ControlCommandBar(CBR As CommandBar, Optional Level As Integer = 1, Optional Idx As Long = 0)
On Error Resume Next
Dim ctl As CommandBarControl
Dim strPrint As String
Dim lngIDX As Long
Dim MenuIndex As Integer
Dim SubMenuIndex As Integer
Dim ItemIndex As Integer
For Each ctl In CBR.Controls
If ctl.Type = msoControlPopup Then
strPrint = String$(Level * 2, " ") & Level & "(" & ctl.Index & ") SubMenù=[" & ctl.CommandBar.Name & "]"
strPrint = strPrint & String$(80 - Len(strPrint), ".") & "Tipo = " & ctl.Type & " <--- Recursive (" & Level & ")"
Debug.Print strPrint
Call ControlCommandBar(ctl.CommandBar, Level + 1, lngIDX)
Else
strPrint = String$(Level * 2, " ") & Level & "(" & ctl.Index & ") Item=[" & ctl.Caption & "]"
strPrint = strPrint & String$(80 - Len(strPrint), ".") & "Tipo = " & ctl.Type
Debug.Print strPrint
End If
Next
End Function
regards