Both Auto_Open and Auto_Activate Macros Run When Sheet Opened

Last reviewed: February 2, 1998
Article ID: Q115276
The information in this article applies to:
  • Microsoft Excel for Windows, versions 4.0a, 5.0, 5.0c
  • Microsoft Excel for Macintosh, versions 4.0, 5.0, 5.0a
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a

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.

MORE INFORMATION

Example

To see an example of this problem, follow these steps:

  1. In Microsoft Excel version 4.0, create a new macro sheet.

  2. On the macro sheet, enter the following:

          A1: Macro1
          A2: =ALERT("AutoOpen")
          A3: =RETURN()
          A4:
          A5: Macro2
          A6: =ALERT("AutoActivate")
          A7: =RETURN()
    

  3. Select cell A1. On the Formula menu, click Define Name. Select the Command option, and click OK.

  4. Select cell A5. On the Formula menu, click Define Name. Select the Command option, and click OK.

  5. Save the macro sheet as TEST.XLM.

  6. Start a new worksheet, leaving TEST.XLM open.

  7. On the Formula menu, click Define Name. In the Name box, type "AUTO_OPEN" (without the quotation marks). In the Refers To box, type "=TEST.XLM!MACRO1" (without the quotation marks). Click OK.

  8. On the Formula menu, click Define Name. In the Name box, type "AUTO_ACTIVATE" (without the quotation marks). In the Refers To box, type "=TEST.XLM!MACRO2" (without the quotation marks). Click OK.

  9. Save the worksheet as TEST.XLS and then close both sheets.

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: 5.00 4.00 3.00 7.00 XL7 XL5 XL4
Keywords : kbmacro kbprg
Version : WINDOWS:4.0a,5.0,5.0c,7.0,7.0a; MACINTOSH:4.0,5.0,5.0a
Platform : MACINTOSH WINDOWS
Issue type : kbprb


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