When working with context menus, I've used the macros below to show the name
of the context menu *in* the context menu.
Use at your own risk... The macros mess with your context menus, and aren't
that well tested.
If in doubt, don't save Normal.dot after you have run the macro... That way,
any changes will not be permanent.
Klaus
Sub ContextMenusShowName()
' run to show the name of the context menu
' in the context menu (for all context menus)
Dim myCB As CommandBar
Dim myCBB As CommandBarButton
On Error Resume Next
For Each myCB In CommandBars
If myCB.Type = msoBarTypePopup Then
Debug.Print myCB.Name, myCB.Type
Set myCBB = myCB.Controls.Add(Type:=msoControlButton, Before:=1)
With myCBB
.Caption = "context menu: " & myCB.Name
.Tag = "ContextMenusShowName"
End With
End If
Next myCB
End Sub
Sub ContextMenusRemoveName()
' run to remove the controls added by "ContextMenusShowName()"
Dim myCB As CommandBar
Dim myCBB As CommandBarButton
Dim myCBC As CommandBarControl
Dim myCBBCaption As String
Dim myCBCs As CommandBarControls
For Each myCB In CommandBars
If myCB.Type = msoBarTypePopup Then
Set myCBCs = myCB.Controls
For Each myCBC In myCBCs
If myCBC.Type = msoControlButton _
And myCBC.ID = 1 And myCBC.Tag = "ContextMenusShowName" Then
Debug.Print myCBC.Caption
myCBC.Delete
End If
Next myCBC
End If
Next myCB
End Sub