MappingCollection Property (ContextMenu)
Gets a value indicating the set of menu items comprising this context menu.
This example removes a menu item named "Open Word" from a custom menu. It uses the MappingCollection property to get the menu items in the menu.
Public Sub RemoveMenuItem()
Dim menuItems() As ContextMenuItem
Dim i As Long
Dim menu As contextMenu
'Get the custom menu.
Set menu = ThisIbmTerminal.ContextMenus.ItemByName("myContextMenu")
'Get the menu items in the menu.
menuItems = menu.MappingCollection
'Find the menu item and remove it.
For i = 1 To UBound(menuItems)
Debug.Print menuItems(i).Name
If menuItems(i).Name = "Open Word" Then
Debug.Print i & menuItems(i).Name & menu.Count
menu.RemoveItem (i)
End If
Next
'Update the menu
ThisIbmTerminal.ContextMenus.Add menu
End Sub