The Flags property of an OlapMenuItem object determines the state of the menu item, such as whether the item is enabled, the place of the item in the menu hierarchy, and so on.
Values can be combined by adding them together.
'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 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
MenuItems.Add mnuStandard, "&Form", mnuActAddNewForm, , _
mnuflagNew + NOT mnuflagChecked
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
If MenuItem.Flag AND NOT mnuflagChecked Then
'menu item unchecked, execute code
End If
Exit Function
ExecuteMenuItem_Err:
MsgBox "ExecutemenuItem Failed"
Err.Clear
End Function