Applies To
MenuItems Collection.
Description
Adds a new submenu to the menu. This method can also be used to restore a built-in submenu that was previously deleted, by setting the restore argument to True.
Syntax
object.AddMenu(caption, before, restore)
object
Required. The MenuItems object.
caption
Required. The caption to use for the new submenu. To create an access key, put an ampersand (&) before the access-key letter.
before
Optional. If this argument is present, specifies the menu item before which this submenu should be inserted. May be a string containing the caption of the menu item (without the ampersand), a number indicating the position of the menu item, or a reference to the menu item.
restore
Optional. If this argument is True, Microsoft Excel will restore the previously deleted built-in submenu named by the caption argument. If False or omitted, Microsoft Excel will add a new submenu. The restored submenu is placed at the end of the menu unless you use the before argument to specify the location.
See Also
Add Method (MenuItems Collection).
Example
This example adds a new submenu to the Help menu on the Worksheet menu bar and then adds a submenu item to it.
Set newSubMenu = MenuBars(xlWorksheet).Menus("Help"). _ MenuItems.AddMenu(Caption:="More") newSubMenu.MenuItems.Add Caption:="More Help"