Deleting Menu Components

You can delete built-in or custom items from menus; you can delete built-in or custom menus from menu bars; and you can delete custom menu bars. Note, however, that although you can delete all the items on shortcut menus and built-in menu bars, you cannot delete the shortcut menus or built-in menu bars themselves.

Deleting built-in menu components can help you tailor your application to the needs of your user. For example, you might want to delete a built-in command from a menu and replace it with a custom version of the command that performs specialized tasks for the user. Or you might want to remove certain menu items to simplify the interface or reduce the possibility that inexperienced users will choose commands you didn't intend for them to use.

Note

You can restore built-in menu bars, menus, or menu items that you've deleted. However, you cannot restore custom menu bars, menus, or menu items that you've deleted; you must recreate them.

Using the Menu Editor

The Menu Editor provides a quick, simple way to delete menu components. Remember that changes you make in the Menu Editor will be in effect whenever the workbook where you made the changes is open. If you want to restore built-in components that you've deleted, you must open the Menu Editor from the workbook where you originally made the deletions. For more information, see the following section.

To delete a menu system component

1. While a Visual Basic module is active, click Menu Editor on the Tools menu.

2. In the appropriate box, click the name of the menu bar, menu, menu item, submenu item, or shortcut menu item that you want to delete.

3. Click Delete.

Using Visual Basic

Use the Delete method to delete a custom menu bar, a custom or built-in drop-down menu or submenu, or a custom or built-in menu item. You cannot delete a built-in menu bar or a shortcut menu.

The following example deletes the custom menu bar that has the caption myWorksheetMenubar.


MenuBars("myWorksheetMenubar").Delete

This example deletes the Edit menu from the Chart menu bar.


MenuBars(xlChart).Menus("Edit").Delete

This example deletes the Group menu item from the Drawing Object shortcut menu.


ShortcutMenus(xlDrawingObject).MenuItems("Group").Delete

You can restore built-in components that you've deleted. For more information, see the following section.