Caption (OlapMenuItem)

Analysis Services Programming

Analysis Services Programming

Caption (OlapMenuItem)

The Caption property of an OlapMenuItem object contains the caption exposed in the menu for the node in the tree pane.

Data Type

String

Access

Read/write

Example

The following example adds a Form menu item and tests the caption property of a selected item to determine whether it is this same Form menu item:

'Custom add-in
Private Enum MenuActions
  mnuActAddNewForm
  mnuActRefreshForm
  mnuActDeleteForm
End Enum

Private Sub IOlapAddIn_ProvideMenuItems( _
    CurrentNode Ad DSSAddInsManager.OlapTreeNode, _
    MenuItems As DSSAddInsManager.OlapMenuItems)
  On Error Resume Next 'Handle errors
  'MenuItems is a collection for MenuItem objects
  'Some more code...
  'Menu item Form is added as a child of the standard New menu item
  MenuItems.Add mnuStandard, "&Form", mnuActAddNewForm,,mnuflagNew
End Sub

'Later
Private Function IOlapAddIn_ExecuteMenuItem( _
    CurrentNode As DSSAddInsManager.IOlapTreeNode, _
    MenuItem As DSSAddInsManager.IOlapmenuItem) _
    As DSSAddInsManager.RefreshTreeTypes
  On Error GoTo ExecuteMenuItem_Err 'Handle errors
  'Some code
  If MenuItem.Caption = "Form" Then
    'Code to handle New/Form menu selection
  End If
  Exit Function
ExecuteMenuItem_Err:
  MsgBox "ExecuteMenuItem Failed"
  Err.Clear
End Function

See Also

OlapMenuItem