Fix Excel VBA Breakpoints and Workbook_Open Errors After an Office Update
Question details
The user needs to restore normal Excel VBA debugging and prevent a Workbook_Open procedure from stopping unexpectedly after an Office update.

- Product
- Microsoft Excel VBA in a macro-enabled workbook
- Device & OS
- not provided
- Scenario
- A macro-enabled workbook is opened after an Office upgrade, and the user wants Workbook_Open, F9 breakpoints, and Stop statements to work normally.
- Observed behavior
- The Workbook_Open procedure stops unexpectedly, while F9 breakpoints and the VBA Stop statement no longer behave as expected.
Close all other Excel workbooks before testing so no other open project or add-in affects compilation. Open the affected file with macros disabled first to prevent Workbook_Open from running while you inspect the VBA project.
Recompile the VBA project and reopen the workbook with macros enabled
Use this first when VBA behavior changed immediately after an Office update and the workbook previously worked correctly.
A harmless code edit followed by a full compile can refresh the VBA project state. Compile before reopening the workbook with enabled macros so Excel can identify syntax errors, broken references, or declarations that are no longer compatible.
In Excel, open the macro-enabled workbook and choose Disable Macros in the security warning. If Workbook_Open runs before you can respond, hold Shift while opening the workbook to suppress automatic open macros.
Press Alt+F11, then expand VBAProject in the Project Explorer and open ThisWorkbook.
In the Workbook_Open procedure, add and remove a space or a comment, then choose Debug > Compile VBAProject from the VBA editor menu.
If Excel highlights code or reports an error, correct the indicated procedure, declaration, or reference, then select Debug > Compile VBAProject again until no compile message appears.
Choose File > Save in Excel, close the workbook and Excel, then reopen the file and select Enable Content to test Workbook_Open, F9 breakpoints, and Stop statements.

Check macro security, trusted locations, and VBA references
Use this when the project compiles but macros do not run consistently or breakpoints appear to be ignored.
Update 32-bit and 64-bit API declarations for the installed Office edition
Use this when the issue began after moving to a different Office edition or when the VBA project contains Windows API Declare statements.
Use WPS Office for everyday Excel workbook editing and migration
If a Microsoft Office update has disrupted your workflow, WPS Office provides a free, lightweight office suite with a familiar spreadsheet interface for opening, editing, and migrating compatible workbook files. You can move routine spreadsheet work to WPS Office while reviewing Microsoft-specific VBA and add-in dependencies separately.

Frequently Asked Questions
Why does Workbook_Open run when I am trying to repair the VBA project?
Workbook_Open runs when macros are enabled during workbook opening. Open the file and choose Disable Macros, or hold Shift while opening the workbook to suppress automatic open macros during troubleshooting.
Why is Debug > Compile VBAProject unavailable or not helping?
First choose Run > Reset in the VBA editor to end any active code execution. Then check Tools > References for a MISSING: library and compile again after correcting the reference or the highlighted code error.
Why did my F9 breakpoint disappear after compiling VBA code?
Breakpoints are not permanently stored in the workbook and can be cleared after edits, compilation, a VBA reset, or closing Excel. Open the procedure again and press F9 on an executable statement to recreate the breakpoint.
Can an Office update break old VBA API declarations?
Yes. A move to 64-bit Office or changes in dependent libraries can expose older declarations. Check File > Account > About Excel for bitness and update applicable Declare statements with PtrSafe and LongPtr.
How do I know whether macro security is blocking the workbook?
Open File > Options > Trust Center > Trust Center Settings > Macro Settings. Also review Trusted Locations and confirm that the workbook is not marked as blocked by a security policy or opened from an untrusted location.




