Microsoft KB Archive/78447

{| = Excel: ADD.MENU Command Returns Error Message =
 * width="100%"|

Last reviewed: November 3, 1994

Article ID: Q78447

SUMMARY
The error message &quot;Cannot find Macro&quot; or &quot;Error in Formula&quot; results when a custom command is chosen from a custom menu in Microsoft Excel if both of the following occur:


 * 1) The macro that the custom command calls is included in the menu/command definition as an external reference (for example, &quot;678.XLM!Test&quot;)
 * 2) The filename in the external reference begins with a number, such as the filename 678.XLM.

Steps to Reproduce Problem
  Enter the following into a macro sheet and save the file as 678.XLM. A1: Menus               B1: Newmenu         C1: A2: =ADD.MENU(1,B1:C2)  B2: Newcommand      C2: 678.XLM!HELLO A3: =RETURN A4: A5: HELLO A6: =ALERT(&quot;HELLO&quot;,1) A7: =RETURN  Select cell A5. From the Formula menu, choose Define Name. Select the Command option and choose OK. Select cell A1. From the Macro menu, choose Run. The Newmenu menu should now appear. From Newmenu, choose Newcommand.

In Excel 3.0, the error message &quot;Cannot find Macro&quot; will occur and the macro &quot;HELLO&quot; will not run. In Excel 2.1, the error message &quot;Error in formula&quot; will occur and the macro &quot;HELLO&quot; will not run.

Workaround
When a worksheet name begins with a number, the filename must be enclosed in single quotes if it is to be used when referring to an external reference.

To correct the problem above, change the macro reference in cell C2 to read

C2: '678.XLM'!HELLO