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.

XL2000: "Compile Error: Ambiguous Name Detected" If a Module Contains Duplicate Subroutine Names


View products that this article applies to.

Symptoms

When you open a workbook in Microsoft Excel 2000, you may receive the following error message:
Compile error: Ambiguous name detected: name of a macro

↑ Back to the top


Cause

This error message occurs if a module in your workbook contains two or more subroutines with the same name. You receive the error message when you open the workbook, when you attempt to run a subroutine in the workbook, and when you close the workbook.

↑ Back to the top


Workaround

To prevent this error message from occurring, you must eliminate the duplicate subroutine names from the modules in the workbook. Because this process may cause invalid page faults to occur, it is strongly recommended that you close all open workbooks before performing these steps.
  1. Open the workbook. If you receive the "Ambiguous name detected" error message, proceed to step 2. If you do not receive the error message, the workbook does not contain duplicate subroutine names, and you can close the workbook.
  2. Click OK to dismiss the error message.
  3. In the Code window, either rename the subroutine with the duplicate name or delete it. Repeat until each subroutine in the module has a unique name.
  4. Repeat step 3 for each module in the workbook that contains duplicate subroutine names.
  5. When you are finished, click Close and Return to Microsoft Excel on the File menu. Or, press ALT+F11.
  6. On the File menu, click Save. Then, click Close on the File menu.

↑ Back to the top


More information

In Microsoft Excel 2000, a workbook can contain multiple subroutines with the same name. However, if a single Visual Basic module contains two or more subroutines with the same name, Microsoft Excel cannot distinguish between the two macros, and you will receive the "Ambiguous name detected" error message.

If the behavior described in the "Symptoms" and "Cause" sections is already occurring, use the workaround described in the "Workaround" section to remove the duplicate subroutine names from the workbook. Note that in some cases, it may be necessary to rename all of the subroutines in your workbook to completely eliminate the issue.

↑ Back to the top


Keywords: KB211838, kbprogramming, kbprb, kberrmsg

↑ Back to the top

Article Info
Article ID : 211838
Revision : 6
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 231