XL Err Msg:"Cannot Find Macro" Running Macro from Object

Last reviewed: February 3, 1998
Article ID: Q116280

The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a
  • Microsoft Excel 97 for Windows
  • Microsoft Excel 98 Macintosh Edition

SYMPTOMS

In Microsoft Excel, if you have a defined name in a workbook that is the same as a macro name on a Microsoft Visual Basic for Applications module, you may receive one of the following error messages:

   Cannot find macro <name>

   -or-

   The macro '<name>' cannot be found.

where <name> is the name of the macro assigned to the object.

RESOLUTION

To ensure that this message does not occur, do either of the following:

  • Use unique names for macros as well as names on worksheets.

        -or-
    
  • Specify the complete path to the macro, as in the following example:

         <module name>.<macro name>
    

MORE INFORMATION

Worksheet names or Excel 4.0 Macro sheet names take precedence over the names of macros on module sheets. Because of this order of precedence, the macro name assigned to the object is replaced with the newly defined workbook name (which is not a macro).


Additional query words: 5.00 5.00a 5.00c 7.00 7.00a macro XL5 XL7 XL97 XL98
Keywords : kbprg PgmOthr
Version : WINDOWS:5.0,5.0c,7.0,97; MACINTOSH:5.0,98
Platform : MACINTOSH WINDOWS
Issue type : kbprb
Solution Type : kbworkaround


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: February 3, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.