XL: "Cannot find macro 'Book1!Macro_Name'" with Menu Item

ID: Q122575

The information in this article applies to:

SYMPTOMS

In Microsoft Excel, when you assign a macro to a menu command on the Tools menu, and you then change the name of the macro, you will receive the following error message when you choose the menu command

   Cannot find macro 'Book1!Macro_Name'

where Book1 is the name of the workbook file the macro was stored in, and Macro_Name is the original name of the macro.

CAUSE

When you assign a macro to a command on the Tools menu, Microsoft Excel creates a link to the macro in the specified workbook. When you change the name of the macro, this change is not reflected in the link between the macro and the menu command; therefore, when Microsoft Excel tries to run the original macro, it is unable to locate it.

WORKAROUND

To work around this situation, do the following:

1. Restore the original name to the macro.

2. From the tools menu, choose Macro.

3. In the Macro box, under Macro/Name Reference, select the name of your

   macro, and choose Options.

4. In the Macro Options box, under Assign to, clear the Menu Item On Tools
   Menu check box.

To associate the new name with a command on the Tools menu, change the name of the macro first, and then associate it with a menu command.

REFERENCES

"Visual Basic User's Guide," version 5.0, page 16

Additional query words: 5.00 5.00c 7.00

Version           : WINDOWS: 5.0, 5.0c, 7.0; MACINTOSH: 5.0, 5.0a
Platform          : MACINTOSH WINDOWS

Last Reviewed: May 16, 1998