Microsoft KB Archive/126663

= Microsoft Knowledge Base =

XL: Menu Command Runs Macro from Wrong Add-In
Last reviewed: June 12, 1997

Article ID: Q126663

5.00 5.00c 7.00 | 5.00

WINDOWS        | MACINTOSH kbprg

The information in this article applies to:


 * Microsoft Excel for Windows, versions 5.0, 5.0c
 * Microsoft Excel for the Macintosh, version 5.0
 * Microsoft Excel for Windows 95, version 7.0

SYMPTOMS
In Microsoft Excel, when you create an add-in file, and you add a menu item to the add-in that runs a macro contained in the add-in, when you open that add-in file, and choose the menu item, the wrong macro may be run.

CAUSE
This behavior occurs if you open an add-in that contains a macro with the same name as the macro that is assigned to the menu item BEFORE you open the add-in that actually contains the menu item and the macro that is assigned to the menu item.

For example, if you create two different add-in files, RIGHT.XLA and WRONG.XLA, that both contain a macro called "Test," and you add a menu item to RIGHT.XLA that runs the macro Test in RIGHT.XLA, the macro "Test" in WRONG.XLA runs when you choose the menu item if you open WRONG.XLA before you open RIGHT.XLA.

WORKAROUND
To avoid running the wrong macro when you choose a menu item that is associated with an add-in file, use either of the following methods.

Method 1: When you create an add-in file, create macros in the add-in with

names that are different from macro names in other add-in files that you use. Method 2: If you have two or more add-in files that contain a macro with

the same name, open the add-in that contains an added menu item before you open any other add-in file.

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.