How to Automatically Start an Excel Running Clock on Workbook Open
Question details
The user needs an Excel running clock macro to start automatically as soon as the workbook is opened.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Automating a clock macro to trigger immediately upon file load without requiring manual execution.
- Observed behavior
- The clock macro functions correctly when triggered manually but fails to launch automatically when opening the workbook.
Ensure that you have already created the running clock macro procedure (e.g., 'running_clock') in a standard module before setting up the auto-start event.
Use the Workbook_Open Event in VBA
This method links your existing clock macro to the workbook's open event, ensuring the script runs automatically upon launching the file.
For a macro to execute when a workbook is opened, it must be called from a specific event handler built into Excel's 'ThisWorkbook' object. Placing the call in a standard module will not trigger it on startup.
Press Alt + F11 on your keyboard to open the VBA Editor in Excel.
In the Project Explorer pane on the left side of the window, find your workbook name and double-click on 'ThisWorkbook'.
In the code window, select 'Workbook' from the left dropdown menu to automatically generate a 'Private Sub Workbook_Open()' procedure. Inside this sub, type 'Call running_clock' (replace 'running_clock' with the exact name of your macro).
Save your file as an Excel Macro-Enabled Workbook (.xlsm). When reopening the file, ensure you click 'Enable Content' in the security warning to allow the macro to run.

Easily Manage and Auto-Run Macros in WPS Spreadsheet
WPS Office fully supports VBA macros, allowing you to easily set up auto-starting clocks, automate repetitive tasks, and manage code within a clean, intuitive interface.
- 1. Open WPS Spreadsheet: Launch WPS Office and open your .xlsm file containing the clock macro.
- 2. Enable Macros: Click 'Enable Macros' in the security warning prompt located just below the main ribbon.
- 3. Access VBA Editor: Go to the Developer tab and click on 'Visual Basic' to view, edit, or test your Workbook_Open event code.

Frequently Asked Questions
Why does my Workbook_Open event not trigger?
This usually happens if macros are disabled in your Trust Center settings, or if the code was accidentally placed in a standard module instead of the 'ThisWorkbook' object.
Can I stop the running clock macro once it starts?
Yes. You can assign a boolean variable to track the clock's state and create a separate macro to toggle it to false, stopping the Application.OnTime loop.
What file format must I use for my auto-start macro to work?
You must save your file as a Macro-Enabled Workbook (.xlsm) or an Excel Binary Workbook (.xlsb). Saving as a standard .xlsx will completely remove the VBA code from the file.




