VBA & Macro Problems

Disable Excel Events When a Macro Prevents Saving

Maira MehtabMaira Mehtab Nov 12, 2026 868 views

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.
Before you start

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.

Solution 1Recommended

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.

1
Open the Visual Basic Editor

In Excel, press Alt+F11 to open the Visual Basic for Applications editor.

2
Open the Immediate window

Press Ctrl+G in the VBA editor to display the Immediate window. If it is not visible, choose View > Immediate Window.

3
Turn off application events

Click the Immediate window, type Application.EnableEvents = False, and press Enter.

4
Save the workbook

Return to Excel and use File > Save or press Ctrl+S while application events are disabled.

5
Restore application events

Return to the VBA Immediate window, type Application.EnableEvents = True, and press Enter after the save is complete.

Inspect the macro afterward: Scan the workbook's VBA modules for unfamiliar code before enabling events again. Use Alt+F8 or the VBA Project Explorer to identify macros, and remove only code you recognize as unwanted.
Free Microsoft Office alternative

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. 1. Install WPS Office: Download and install WPS Office, then open WPS Spreadsheets from the Start menu or Applications folder.
  2. 2. Open the workbook: Choose Open from the Home screen or select File > Open, then select the Excel workbook you want to edit.
  3. 3. Review the spreadsheet: Check formulas, formatting, links, and any macro-dependent features because Excel VBA procedures may not run or transfer completely.
  4. 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.
Open and edit common Excel spreadsheet formats, including .xlsx and .xls, with a familiar spreadsheet interface.Use a lightweight alternative for routine workbook editing when Excel VBA is not required.Support migration across Microsoft Office formats such as .xlsx, .docx, and .pptx.Save and share spreadsheets with broadly compatible Office file formatting.Avoid relying on an unwanted Excel event macro for everyday spreadsheet tasks.
microsoft office alternative - wps office

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.