Microsoft KB Archive/107749

= Microsoft Knowledge Base =

Excel: Menu and Toolbar Macro Functions Add Blank Items
Last reviewed: June 30, 1997

Article ID: Q107749

The information in this article applies to:


 * Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a
 * Microsoft Excel for the Macintosh, versions 3.0, 4.0

SUMMARY
Menu and toolbar macro functions such as ADD.BAR, ADD.COMMAND, ADD.MENU, ADD.TOOL, and ADD.TOOLBAR may add blank items when they reference blank cells.

MORE INFORMATION
The ADD.BAR macro function is used to create a new menu bar. If you display the menu bar using the SHOW.BAR command before adding custom menus and commands, an empty menu bar will be displayed.

The ADD.MENU macro function is used to add menus to new or built-in menu bars. If the menu_ref argument consists of empty cells, a blank menu with no commands will be added.

The ADD.COMMAND macro function is used to add commands to existing menus on built-in or custom menu bars. If the command_ref argument consists of empty cells, a blank command is added to the specified menu.

The ADD.TOOLBAR macro function (Microsoft Excel version 4.0 only) is used to create a custom toolbar. If the tool_ref argument points to empty cells or is omitted, an empty toolbar will be created. To display the toolbar, the SHOW.TOOLBAR function must be used.

The ADD.TOOL macro function (Microsoft Excel version 4.0 only) is used to add tools to built-in or custom toolbars. If the tool_ref argument consists of empty cells, no tool is added to the specified toolbar.

Steps to Reproduce Behavior
 In Microsoft Excel version 4.0, choose New from the File menu, then select Macro Sheet and press ENTER to open a new macro sheet.  In the new macro sheet, type the following: A1: =ADD.MENU(1,C1:D2,1) A2: =RETURN NOTE: Cells C1:D2 must be blank  Select cell A1. From the Macro menu, choose Run, and press ENTER.

A blank menu will be added to the default menu bar. The blank menu does not contain any commands.