ADD.MENU macro

Adds a menu to a menu bar. Use ADD.MENU to add a custom menu to a built-in or custom menu bar. You can also use ADD.MENU to restore built-in menus you have deleted with DELETE.MENU. ADD.MENU returns the position number in the menu bar of the new menu.

Syntax

ADD.MENU(bar_num, menu_ref, position1, position2)

Bar_num    is the menu bar to which you want a menu added. Bar_num can be the ID number of a built-in or custom menu bar. See ADD.COMMAND for a list of ID numbers for built-in menu bars.

Menu_ref    is an array or a reference to an area on the macro sheet that describes the new menu or the name of a deleted built-in menu you want to restore.

The rest of the first column indicates the names of the commands. The corresponding rows in the second column give the names of the macros that run when the commands are chosen.

 

Position1    specifies the placement of the new menu. Position can be the name of a menu, as text, or the number of a menu. Menus are numbered from left to right starting with 1. Menus are added to the left of the position specified.

 

Position2    specifies the placement of a submenu.

 

Example

The following macro formula adds a new menu to the end of the worksheet menu bar, where A10:B15 is the menu_ref describing the menu:

ADD.MENU(1, A10:B15)

Related Functions

ADD.BAR   Adds a menu bar

ADD.COMMAND   Adds a command to a menu

DELETE.MENU   Deletes a menu

ENABLE.COMMAND   Enables or disables a menu or custom command

Return to index