Determine which menu item called the current add-in function
[C++]
static BOOL GetCallingMenu(
int& nBar,
int& nMenu,
int& nItem,
int& nSubItem
);
The index of the menu bar to which the menu item belongs. Note that the index of the Excel main application menu bar is 10.
The index of the menu within the bar. Note that the index of the first menu is 1.
The index of the item in the menu. Note that the index of the first item is 1. If the function was called from an item on a sub-menu, then nItem will contain the index of the sub-menu in the main menu.
The index of the item in a sub-menu. If the item was not part of a sub-menu then this will contain 0, and should be ignored. 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
nBar, nMenu, nItem and nSubItem arguments.
Header: xlmenu.h