Used to create run-time menus which are attached to the Excel application menu bar.
The CXlMenu class can be used to create run-time menus which are attached to the Excel application menu bar.
An instance of CXlMenu should be created for each top-level menu to be added. Each menu can contain any number of menu items.
The menu object should be a member of the add-in's application class (derived from CXllApp). The menu should be attached to the application bar during the CXllApp::OnXllOpenEx() event, using the Create() method. The menu should be removed during the CXllApp::OnXllClose() event, using the Destroy() method.
Items can be added to the menu (before Create() is called) using the AddItem() method. After Create() has been called, you can call the following functions to manipulate the menu or sub-menu: AddItem, DeleteItem, ReplaceItem, EnableItem, and CheckItem.
Many of the text arguments to CXlMenu methods may be resource ID strings. These are loaded from the application resource file at run-time. For example, you can add a menu item whose caption is held in resource 234 in the resource file, as follows:
m_menu.AddItem("#234", "Intl3_SelectLanguage");The string will be loaded in the current user's preferred language, if available. See International support for more information.
The functions that accept and translate resource ID strings are listed below.
You can find full examples of using the CXlMenu class below: