InfoConnect VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / ContextMenu Object / MappingCollection Property
Example
In This Topic
    MappingCollection Property (ContextMenu)
    In This Topic
    Gets a value indicating the set of menu items comprising this context menu.
    Syntax
    expression.MappingCollection As ContextMenuItem()
    where expression is a variable that represents a ContextMenu Object

    Property Value

    A ContextMenu object
    Example
    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
    See Also