XL:Both Auto_Open and Auto_Activate Macros Run When Sheet Opened

ID: Q115276

The information in this article applies to:

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

Last Reviewed: October 13, 1998