Determine which the position of the menu item which called the current add-in function
static BOOL GetCallingMenuItemPosition( int& nItem ); |
The index of the item in the menu or sub-menu. Note that the index of the first item is 1.
Returns TRUE if the current add-in function was called from a menu, FALSE if not.
If the current add-in function was called from a menu item, this static function returns TRUE and sets the values of the nItem argument.
This method is provided for use by add-ins that must run under Excel 2007 (and optionally other versions of Excel). There is a bug in Excel 2007, which means that the standard method CXlMenu::GetCallingMenu() returns inconsistent and incorrect results. This simpler method works around the Excel 2007 bug and returns correct results under all versions of Excel. Note that this method cannot differentiate between different menus or submenus - it can only return the position of the called item within its menu or submenu. It is therefore essential that the developer provide different call-back functions for different menus and sub-menus; within each menu-specific call-back function this method can be used to check which item within the menu or sub-menu was clicked.
Header: xlmenu.h