Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q116280

↑ Back to the top


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.

↑ Back to the top


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>

↑ Back to the top


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).

↑ Back to the top


Keywords: KB116280, kbprb, kbprogramming

↑ Back to the top

Article Info
Article ID : 116280
Revision : 4
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 528