XL: Both Auto_Open and Auto_Activate Macros Run When Sheet Opened

ID: Q115276


The information in this article applies to:
  • Microsoft Excel for Windows, versions 4.0a, 5.0, 5.0c
  • Microsoft Excel for the 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. In the Refers To box, type =TEST.XLM!MACRO1. Click OK.


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


  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: 4.00 3.00 XL7 XL5 XL4

Keywords : kbmacro kbprg
Version : MACINTOSH:4.0,5.0,5.0a; WINDOWS:4.0a,5.0,5.0c,7.0,7.0a
Platform : MACINTOSH WINDOWS
Issue type : kbprb


Last Reviewed: September 9, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.