HOW TO: How do I add a new menu to Excel's menu bar?

Reference: Q0007

Article last modified on 21-Dec-2005


The information in this article applies to:

  • XLL+ for Visual Studio 6 - 3, 4.1, 4.2, 4.3.1
  • XLL+ for Visual Studio .NET - 3, 4.1, 4.2, 4.3.1
  • Excel - all versions

How do I add a new menu to Excel's menu bar?

Question

How do I add my own menu bar to Excel's menus?

Answer

You can use the XLL+ AppWizard to add code for this purpose to your add-in when it is created; see the topic Menus in the XLL+ User Guide to learn how.

There are several sample applications which contain code to create menus:

  1. Simple Menus Sample demonstrates how to use the CXlMenu class to add a menu to Excel's main application menu bar, and how to remove it again.
  2. Advanced Menus Sample demonstrates how to use the CXlMenu class to add a menu with sub-menus, and how to remove it again.
  3. InterSingle Sample and InterMulti Sample demonstrate how to localize your menu so that text appears in the language of the user.