Add

The Add method of the OlapMenuItems collection adds a new OlapMenuItem object to the collection.

Syntax

Add(MenuType As OlapMenuTypes, [Caption As String], [Key As Long], [ParentKey As Long], [Flags As OlapMenuFlags]) As OlapMenuItem

Calling Arguments
MenuType
MenuType can be either mnuSeparator or mnuStandard.
Caption
The string value to be displayed in the menu.
Key
User-defined key value to be used by the add-in program.
ParentKey
Associates a child menu item with its parent. Used when the parent menu item is defined using the mnuflagPopup option.
Flags
Flag or combination of flags that specify the state of the menu item.
Returns

OlapMenuItem

Remarks

The Add method is used to populate the OlapMenuItems collection with menu items to be displayed when the user right-clicks a tree node. Call this method for each menu item you want to add.

Example

Private Enum MenuActions

  mnuActTop

  mnuActMid

  mnuActBtm

  mnuActSpc

End Enum

Private Sub IOlapAddIn_ProvideMenuItems(CurrentNode As DSSAddInsManager.OlapTreeNode, MenuItems As DSSAddInsManager.OlapMenuItems)

  On Error GoTo ProvideMenuItems_Err 'Handle errors

  If CurrentNode.Caption = "Node 1" Then

    'Enable default New menu item and add child menu items

    MenuItems.Add mnuStandard, "&Top", mnuActTop, , mnuflagNew

    MenuItems.Add mnuStandard, "&Mid", mnuActMid, , mnuflagNew

    MenuItems.Add mnuStandard, "&Btm", mnuActBtm, , mnuflagNew

    'Add regular menu item to root menu

    MenuItems.Add mnuStandard, "&Special", mnuActSpc, , mnuflagRegular

  End If

  Exit Sub

ProvideMenuItems_Err:

  MsgBox "ProvideIcon failed"

  Err.Clear

End Sub

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.