The Key property of an OlapMenuItem object contains a value specified by your add-in program.
This property is a user-defined value assigned by the add-in program. It can be used for any purpose required by your add-in program.
Private Enum MenuActions
mnuActAddNewForm
mnuActRefreshForm
mnuActDeleteForm
End Enum
Private Sub IOlapAddIn_ProvideMenuItems( _
CurrentNode As DSSAddInsManager.OlapTreeNode, _
MenuItems As DSSAddInsManager.OlapMenuItems)
On Error GoTo ProvideMenuItems_Err '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
'mnuActAddNewForm is our Key value
MenuItems.Add mnuStandard, "&Form",mnuActAddNewForm,,mnuflagNew
Exit Sub
ProvideMenuItems_Err:
MsgBox "ProvideMenuItems Failed"
Err.Clear
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
'Check the Key value
If MenuItem.Key = mnuActAddNewForm Then
'code to add a new form
End If
Exit Function
ExecuteMenuItem_Err:
MsgBox "ExecutemenuItem Failed"
Err.Clear
End Function