Microsoft KB Archive/115276

= Both Auto_Open and Auto_Activate Macros Run When Sheet Opened =

Article ID: 115276

Article Last Modified on 8/15/2003

-

APPLIES TO


 * Microsoft Excel 95a
 * Microsoft Excel 5.0c
 * Microsoft Excel 4.0a
 * Microsoft Excel 5.0a for Macintosh
 * Microsoft Excel 4.0 for Macintosh

-



This article was previously published under Q115276



SYMPTOMS
In the versions of Microsoft Excel listed above, if a worksheet has both an Auto_Open and an Auto_Activate macro, both macros will run when that worksheet is opened.

NOTE: In Microsoft Excel versions 4.0 and earlier for Windows and 3.0 and earlier for Macintosh, only the Auto_Open macro will run when the worksheet is opened.



STATUS
This is a known problem in the versions of Microsoft Excel listed at the beginning of this article. This problem was corrected in Microsoft Excel 97 for Windows and Microsoft Excel 98 Macintosh Edition.



Example
To see an example of this problem, follow these steps:  In Microsoft Excel version 4.0, create a new macro sheet. On the macro sheet, enter the following:

A1: Macro1

A2: =ALERT("AutoOpen")

A3: =RETURN

A4:

A5: Macro2

A6: =ALERT("AutoActivate")

A7: =RETURN

 Select cell A1. On the Formula menu, click Define Name. Select the Command option, and click OK. Select cell A5. On the Formula menu, click Define Name. Select the Command option, and click OK. Save the macro sheet as TEST.XLM. Start a new worksheet, leaving TEST.XLM open.</li> On the Formula menu, click Define Name. In the Name box, type AUTO_OPEN. In the Refers To box, type =TEST.XLM!MACRO1. Click OK.</li> On the Formula menu, click Define Name. In the Name box, type AUTO_ACTIVATE. In the Refers To box, type =TEST.XLM!MACRO2. Click OK.</li> Save the worksheet as TEST.XLS and then close both sheets.</li></ol>

Open TEST.XLS in Microsoft Excel version 4.0. Only the alert with the "AutoOpen" message appears.

Open TEST.XLS in Microsoft Excel version 4.0a or 5.0. An alert with the message "AutoOpen" appears followed by another with the message "AutoActivate".

Additional query words: 4.00 3.00 XL7 XL5 XL4 XL

Keywords: kbmacro kbprogramming kbprb KB115276

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.