Disable Excel Events When a Macro Prevents Saving
Question details
The user needs to temporarily disable Excel application events so an unwanted or unknown event-driven macro does not prevent the workbook from being saved.
- Product
- Microsoft Excel VBA
- Device & OS
- not provided
- Scenario
- A workbook runs VBA code during normal activity, such as saving, changing cells, or opening the file, and the user needs to save it before investigating the macro.
- Observed behavior
- An event-driven macro runs unexpectedly and blocks or interferes with saving the workbook.
Make a backup copy of the workbook before changing VBA settings or removing code. Keep the workbook open in Excel and confirm that you can access the Visual Basic Editor with Alt+F11.
Disable Excel application events from the VBA Immediate window
Use this temporary workaround when an event-driven macro runs during workbook activity and prevents the file from saving.
Application events control event procedures such as Workbook_BeforeSave, Worksheet_Change, and Workbook_Open. Turning them off can allow the current workbook to be saved, but it does not remove or repair the underlying macro.
In Excel, press Alt+F11 to open the Visual Basic for Applications editor.
Press Ctrl+G in the VBA editor to display the Immediate window. If it is not visible, choose View > Immediate Window.
Click the Immediate window, type Application.EnableEvents = False, and press Enter.
Return to Excel and use File > Save or press Ctrl+S while application events are disabled.
Return to the VBA Immediate window, type Application.EnableEvents = True, and press Enter after the save is complete.
Review and remove the event procedure causing the save failure
Use this approach when you can identify the macro or want a lasting fix instead of leaving events disabled.
Switch to WPS Office for lightweight Excel-compatible workbook editing
WPS Office is a free, lightweight alternative for opening, editing, and saving common Microsoft Office files with a familiar interface. It can help you migrate routine spreadsheet work when an Excel-specific VBA event macro is causing save problems, although Microsoft Excel remains necessary for full VBA macro execution and debugging.
- 1. Install WPS Office: Download and install WPS Office, then open WPS Spreadsheets from the Start menu or Applications folder.
- 2. Open the workbook: Choose Open from the Home screen or select File > Open, then select the Excel workbook you want to edit.
- 3. Review the spreadsheet: Check formulas, formatting, links, and any macro-dependent features because Excel VBA procedures may not run or transfer completely.
- 4. Save in an Office-compatible format: Choose File > Save As and select Excel 2007-365 Workbook (*.xlsx) when the workbook does not need VBA, then verify the saved file in Excel if required.

Frequently Asked Questions
What does Application.EnableEvents = False do in Excel?
It temporarily stops Excel from triggering application and worksheet event procedures, including events such as Workbook_BeforeSave and Worksheet_Change. It does not disable all macros or delete VBA code.
How do I turn Excel events back on after saving?
Press Alt+F11, press Ctrl+G to open the Immediate window, enter Application.EnableEvents = True, and press Enter. Re-enable events after the workbook has been saved and reviewed.
Why can an Excel macro prevent a workbook from saving?
A procedure such as Workbook_BeforeSave may contain an error, an endless loop, a forced cancellation, or unwanted code that interrupts the save process. Disabling events bypasses the event temporarily so you can investigate it.
Will disabling events remove the unwanted Excel macro?
No. It only changes the current Excel application setting. Inspect the workbook in the Visual Basic Editor and remove or repair the suspicious event procedure after creating a backup.
Can WPS Office run the Excel VBA code that blocks saving?
WPS Office can open and edit many Excel files, but it is not a complete replacement for Microsoft Excel's VBA environment. Use Excel to inspect and debug VBA, and use WPS for routine spreadsheet editing when macros are not required.




