expression.RemoveItem( _ ByVal index As Integer _ )
where expression is a variable that represents a ContextMenu Object
Parameters
- index
- Identifies the position within the menu at which to remove a menu item.
expression.RemoveItem( _ ByVal index As Integer _ )
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