Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / ContextMenu Object / RemoveItem Method
Identifies the position within the menu at which to remove a menu item.
Example
In This Topic
    RemoveItem Method (ContextMenu)
    In This Topic
    Removes a specified context menu item at a given position within the menu
    Syntax
    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.
    Example
    This example removes a menu item named "Open Word" from a custom 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
    See Also