VBA & Macro Problems

How to Fix Excel Auto_Open Macro Not Running on Startup

Adam DavisAdam Davis Nov 4, 2026 868 views

Question details

The user needs to resolve an issue where an Auto_Open procedure fails to execute automatically upon opening an Excel workbook.

How to Fix Excel Auto_Open Macro Not Running on Startup
Product
Microsoft Excel
Device & OS
not provided
Scenario
Setting up a macro to run automatically when the Excel workbook is initially opened.
Observed behavior
The Auto_Open macro placed in the ThisWorkbook module does not trigger reliably when the file is opened.
Before you start

Ensure your Excel Trust Center settings are configured to allow macros to run, and that your file is saved as a Macro-Enabled Workbook (.xlsm).

Solution 1Recommended

Replace Auto_Open with the Workbook_Open Event

The most reliable method for running startup code is to use the built-in Workbook_Open event located directly in the ThisWorkbook module.

Auto_Open is a legacy feature that typically belongs in a standard module. When placed in the ThisWorkbook module, it often behaves unreliably or fails to trigger entirely. Microsoft recommends transitioning all startup macros to the Workbook_Open event.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to launch the Visual Basic for Applications (VBA) editor in Excel.

2
Access the ThisWorkbook Module

In the Project Explorer pane on the left side, locate your current workbook's VBA project and double-click on 'ThisWorkbook'.

3
Insert the Event Procedure

At the top of the code window, select 'Workbook' from the left dropdown menu. The 'Private Sub Workbook_Open()' structure will be generated automatically.

4
Transfer Your Code

Copy the macro instructions from your old Auto_Open routine and paste them inside the new Workbook_Open sub. Delete the old Auto_Open macro to prevent conflicting triggers.

Replace Auto_Open with the Workbook_Open Event
Save as Macro-Enabled: Remember to save your file using the .xlsm extension so that the new VBA code is retained the next time you open the document.
Free Microsoft Office alternative

A Lightweight and Compatible Excel Alternative: WPS Office

If you frequently encounter legacy macro bugs or slow workbook loading in Microsoft Office, consider switching to WPS Office. It provides a lightweight, highly compatible, and intuitive alternative for managing all your spreadsheets effortlessly.

Seamlessly open, edit, and save Microsoft Excel formats, including .xlsx and .xlsm files.Lightweight software architecture that loads large spreadsheets quickly and smoothly.Free to download with a user interface highly familiar to MS Office users.Provides comprehensive built-in formulas, pivot tables, and advanced charting functionalities.
microsoft office alternative - wps office

Frequently Asked Questions

What is the difference between Auto_Open and Workbook_Open?

Auto_Open is a legacy macro from older versions of Excel that runs when a workbook is opened and is typically placed in a standard module. Workbook_Open is a modern event handler strictly placed in the ThisWorkbook module, offering a more reliable standard for executing startup code.

Why does my Auto_Open macro run when opened manually but not from another macro?

When a workbook is opened programmatically via VBA code (using Workbooks.Open), the Auto_Open macro is intentionally bypassed. You would need to explicitly trigger it using the RunAutoMacros method. Conversely, the Workbook_Open event triggers regardless of how the file is opened.

Where exactly should I put the Workbook_Open code?

The Workbook_Open code must be placed exclusively inside the 'ThisWorkbook' object module in the VBA Editor. It will not function if placed in standard modules like 'Module1' or sheet modules.

Can I use both Auto_Open and Workbook_Open in the same file?

While it is technically possible, it is highly discouraged as it makes debugging difficult. If both exist within the same workbook, the Workbook_Open event will execute first, followed immediately by the Auto_Open macro.