How to Fix Excel Auto_Open Macro Not Running on Startup
Question details
The user needs to resolve an issue where an Auto_Open procedure fails to execute automatically upon opening an Excel workbook.

- 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.
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).
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.
Press Alt + F11 on your keyboard to launch the Visual Basic for Applications (VBA) editor in Excel.
In the Project Explorer pane on the left side, locate your current workbook's VBA project and double-click on 'ThisWorkbook'.
At the top of the code window, select 'Workbook' from the left dropdown menu. The 'Private Sub Workbook_Open()' structure will be generated automatically.
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.

Verify Excel Macro Security Settings
If the Workbook_Open event still does not run, Excel's security settings may be actively blocking all VBA execution.
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.

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.




