XLL+ Class Library (7.0)

Advanced Menus Sample - SubMenus

Adds a menu and dynamic sub-menus to Excel's application menu bar


This project demonstrates how to use the CXlMenu class to add a menu with sub-menus to Excel's main application menu bar, and how to remove it again.

It also shows how to manipulate menus dynamically.

Classes and functions used

CXlMenu | CXlMenu::Create | CXlMenu::SetTexts | CXlMenu::AddItem | CXlMenu::Destroy | CXllApp::OnXllOpenEx | CXllApp::OnXllClose | CXlMenu::DeleteItem | CXlMenu::EnableItem | CXlMenu::GetCallingMenu

Sample project

Each sample project is located in a sub-directory of the Samples directory of the XLL+ installation. To use the sample project, open the solution file SubMenus.sln or the project file SubMenus.vcproj.

You can enable debugging under Excel by using the Setup Debugging command in the XLL+ ToolWindow.

When delivered, the help files are excluded from the build. You can enable the help build by selecting the files SubMenus.help.xml and SubMenus.chm in the Solution Explorer, and using the right-click menu to view Properties. Select the page "Configuration Properties/General" and set the "Excluded from build" property to "No". See Generating help in the User Guide for more information.

See Also

List of Sample Projects | Simple menus sample | Menus (User Guide)