Microsoft KB Archive/44733

From BetaArchive Wiki

Excel’s ADD.MENU Returns “Name Not Defined” Error PSS ID Number: Q44733 Article last modified on 02-26-1993 PSS database name: W_eXceL

2.x 3.00



When using the ADD.MENU command in Excel, if the menu option that is being added calls a macro with a hyphen in the name, an error message will be returned. In Excel 2.1, the message is “Name not Defined.” In Excel 3.0, the message is "Cannot find macro ‘macroname!reference’.

More Information:

The following is an example of this behavior:

A1: Menus B1: newmenu C1: A2: =ADD.MENU(1,B1:C2) B2: newcommand C2: TEST-1.XLM!BEEPME A3: =RETURN() A4: A5: BEEPME A6: =BEEP() A7: =RETURN()

Run “Menus” to add “newmenu” to the menu bar. If you select “newcommand” from this menu option, you will get the error and “BEEPME” does not run.

If you put single quotes around the file name in cell C2, the command runs correctly (i.e. In cell C2 type ‘TEST-1.XLM’!BEEPME)

Note: “Menus” (in cell $A$1) and “BEEPME” are defined as command macros on the macro sheet.

Copyright Microsoft Corporation 1993.