ExecuteMenuItem (IOlapAddIn Interface)

Analysis Services Programming

Analysis Services Programming

ExecuteMenuItem (IOlapAddIn Interface)

The ExecuteMenuItem method of the IOlapAddIn interface is called when the user clicks a menu item. Provide code in this method to respond to the user's actions.

Syntax

Function ExecuteMenuItem(CurrentNode As OlapTreeNode, MenuItem As OlapMenuItem) As RefreshTreeTypes

CurrentNode

The node that is currently selected in the Analysis Manager tree pane.

MenuItem

The menu item that the user clicked.

Remarks

By querying the properties of the CurrentNode and MenuItem objects, your application can determine which menu item the user clicked and respond accordingly. The function returns a constant from the RefreshTreeTypes enumeration.

Example

The following example shows how to execute a menu item based upon the caption of the node that is currently selected in the tree view:

Private Function IOlapAddIn_ExecuteMenuItem( _
    CurrentNode As DSSAddInsManager.OlapTreeNode, _
    MenuItem As DSSAddInsManager.OlapMenuItem) _
    As DSSAddInsManager.RefreshTreeTypes
  On Error GoTo ExecuteMenuItem_Err 'Handle errors
  Select Case CurrentNode.Caption
    Case "Add"
      Select Case MenuItem.Key
        Case mnuactAddItem1
          'Code to add item 1
        Case mnuactAddItem2
          'Code to add item 2
        Case mnuactAddItem3
          'Code to add item 3
      End Select
 
    Case "Edit"
      Select Case MenuItem.Key
        Case mnuactEditItem1
          'Code to edit item 1
        Case mnuactEditItem1
          'Code to edit item 2
        Case mnuactEditItem1
          'Code to edit item 3
      End Select
  End Select
 
  Exit Function
ExecuteMenuItem_Err:
  MsgBox "ExecuteMenuItem Failed"
  Err.Clear
End Function
 

See Also

IOlapAddIn Interface

RefreshTreeTypes Enumeration