Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / ContextMenu Object / Name Property
Example
In This Topic
    Name Property (ContextMenu)
    In This Topic
    Gets or sets a value indicating the descriptive name of this menu.
    Syntax
    expression.Name As String
    where expression is a variable that represents a ContextMenu Object
    Exceptions
    ExceptionDescription
    Thrown if value contains illegal characters
    Example
    This example creates a new menu and names it "My Custom Menu." Then it assigns it as the default context menu.
    Public Sub ChangeContextMenu()
     
        Dim action As InputMapAction
        Dim sequence As InputMapActionSequence
        Dim menuItem As ContextMenuItem
        Dim OldDefaultMenu As contextMenu
        Dim MyCustomMenu As contextMenu
        
        'Save the current default menu
        Set OldDefaultMenu = New contextMenu
        Set OldDefaultMenu = ThisIbmTerminal.ContextMenus.ItemByName("Default")
        OldDefaultMenu.Name = "Default Menu"
        ThisIbmTerminal.ContextMenus.Add OldDefaultMenu
          
        'Create a new menu
        Set MyCustomMenu = New contextMenu
        MyCustomMenu.Name = "My Custom Menu"
        
        'Create an action sequence to hold the actions
        Set sequence = New InputMapActionSequence
            
        'set an action to open the Office Tools Pane and add to the sequence
        Set action = New InputMapAction
        action.ActionId = InputMapActionID_OfficeToolsPaneAction
        sequence.Add action
        
        'create the menu item for the Office Tools action and add it to the sequence
        Set menuItem = New ContextMenuItem
        menuItem.Name = "Open Office Tools"
        menuItem.MenuItemType = ContextMenuItemType_MenuItem
        Set menuItem.mapping = sequence
       
        'add the Office Tools menu item to the menu
        MyCustomMenu.AddMenuItem menuItem
        
        'Add the menu
        ThisIbmTerminal.ContextMenus.Add MyCustomMenu
        
        'Change the default menu
        Set ThisIbmTerminal.ContextMenus.DefaultContextMenu = MyCustomMenu
            
    End Sub
    See Also