Article ID: 213550 - Last Review: October 11, 2006 - Revision: 5.1 XL2000: Sample Macros for Customizing Menus and SubmenusThis article was previously published under Q213550 On This PageSUMMARY In Microsoft Excel 2000, toolbars, menu bars, and shortcut
menus are considered a single type of object, called a command bar. This
behavior is different from versions of Excel earlier than Excel 97. Although
most Visual Basic for Applications macros that you create in earlier versions
of Excel that customize menus and toolbars work in Excel 2000, some may fail.
If this happens, modify the macro code to work with the new object type.
This article provides several examples that illustrate how to customize menu bars, menus, and toolbars in Microsoft Excel 2000. NOTE: Many of the sample macros in this article use the ID number for a particular control as an argument for the Add method. You must know the ID number if you want to restore built-in menus that you deleted. For a list of ID numbers assigned to built-in command bar controls, please see the following article in the Microsoft Knowledge Base: 213552
(http://support.microsoft.com/kb/213552/EN-US/
)
XL2000: List of ID Numbers for Built-In Command Bar Controls
MORE INFORMATIONMicrosoft provides programming examples for illustration only,
without warranty either expressed or implied. This includes, but is not limited
to, the implied warranties of merchantability or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language that is being demonstrated and with the tools that are used to create
and to debug procedures. Microsoft support engineers can help explain the
functionality of a particular procedure, but they will not modify these
examples to provide added functionality or construct procedures to meet your
specific requirements.
Deleting an Entire Menu BarThe following macro disables the worksheet menu bar. After you run the following macro, the menu bar is not displayed when a worksheet is active.Deleting and Restoring a Menu on a Menu BarThe following macro deletes the Help menu from the worksheet menu bar.Deleting and Restoring a Menu Command on a MenuThe following macro deletes the Office on the Web command on the Help menu.Deleting and Restoring a Submenu on a MenuThe following macro deletes the Sheet submenu on the Format menu.Deleting and Restoring a Menu Command on a SubmenuThe following macro deletes the Protect Sheet menu command on the Protection submenu (on the Tools menu).Deleting and Restoring a Menu on a ToolbarThe following macro deletes the Draw menu on the Drawing toolbar.Deleting and Restoring a Menu Item on a Shortcut MenuThe following macro deletes the Insert Comment menu command on the worksheet cell shortcut menu.REFERENCESFor more
information about programmatically customizing command bars, in the Visual
Basic Editor, click Microsoft Visual Basic Help on the Help menu, type Overview of Command Bars in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
| Article Translations
|

Back to the top
