Excel: Using ADD.COMMAND to Move Built-in Menu Items

Last reviewed: November 2, 1994
Article ID: Q67460

SUMMARY

The macro function ADD.COMMAND can be used in Microsoft Excel version 3.00 to replace built-in menu items that were removed with DELETE.COMMAND. However, the following conditions must be met for ADD.COMMAND to function properly:

  1. DELETE.COMMAND must have been used to delete the menu item.

  2. The command that was deleted can be added back only to the same menu on the same bar. ADD.COMMAND cannot be used to change which menu a command is located on, but it can be used to change the position of the command (on the same menu).

  3. Either the name of the command (as a text string) or the unique ID number (returned by DELETE.COMMAND) must be used to restore the menu item. For example, to add the Quit command the the File menu on menu bar 1 (Full Menus), the following command is used:

          =ADD.COMMAND(1,"File","Quit",23)
    

    The number 1 specifies the bar number, "File" is the name (as a text string) of the menu, "Quit" is the name of the command, and 23 tells Excel to place the command in the 23rd position on the menu (position is optional).

For more information on ADD.COMMAND, see pages 5-6 of the "Microsoft Excel Function Reference" version 3.0 manual.

For more information on DELETE.COMMAND, see pages 51-52 of the "Microsoft Excel Function Reference" version 3.0 manual.


KBCategory: kbother
KBSubcategory:



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.