logo
search
VBA & Macro Problems

Stop Excel Asking to Save Hidden Read-Only Workbook on Close

Maira MehtabMaira Mehtab Sep 22, 2026 868 views

Question details

The user wants to prevent Excel from repeatedly prompting to save a hidden, read-only macro toolbox workbook every time the application is closed.

Product
Microsoft Excel 2019
Device & OS
Windows 11
Scenario
Closing the Excel application while a hidden, read-only workbook containing macros is open in the background.
Observed behavior
Following a Windows 11 update, Excel unexpectedly prompts the user to save the hidden, read-only workbook upon exiting.
Before you start

Ensure you have the Developer tab enabled in Excel to access and edit VBA modules, and create a backup of your toolbox workbook before making script modifications.

Solution 1Recommended

Use an Auto_Close VBA Macro to Suppress the Save Prompt

By adding a specific Auto_Close macro to the workbook, you can instruct Excel to treat the file as already saved, bypassing the prompt when the application closes.

This VBA script forcibly sets the workbook's 'Saved' property to True right before the file closes. This effectively tricks Excel into believing no changes have been made, even if volatile functions or macros were triggered.

1
Open the VBA Editor

Unhide your toolbox workbook if necessary, make it the active window, and press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) Editor.

2
Insert a New Module

In the Project Explorer pane on the left, right-click on your specific toolbox workbook name. Select 'Insert' from the context menu, then choose 'Module'.

3
Input the Auto_Close Code

In the newly opened code window, paste the following VBA script exactly: Sub Auto_Close() ThisWorkbook.Saved = True End Sub

4
Save and Test

Save the workbook and exit the VBA Editor. Close Excel to verify that the application now exits without prompting you to save this specific read-only workbook.

Data Loss Precaution: This macro suppresses the save prompt unconditionally for this workbook. It should only be used on files that are strictly read-only or where you do not want to retain any session changes.
Free Microsoft Office alternative

Switch to WPS Office for a Stable, Glitch-Free Macro Experience

If recent Windows 11 updates are causing Microsoft Excel to display unexpected save prompts or alter your UI settings, consider migrating to WPS Office. It provides a lightweight, highly compatible environment for running your custom VBA toolboxes without unexpected update glitches.

  1. 1. Download and Install: Download WPS Office for free from the official website and follow the simple installation wizard.
  2. 2. Open Your Macro Workbooks: Open your existing .xlsm or read-only toolbox workbooks directly in WPS Spreadsheets without needing to convert them.
  3. 3. Enable Macros and Work Seamlessly: Enable macro execution in WPS Spreadsheets and enjoy full functionality without the unwarranted save prompts caused by Office updates.
100% compatible with Microsoft Excel formats (.xlsx, .xlsm, .csv)Natively supports VBA and macros for your advanced toolboxesLightweight application that runs smoothly on Windows 11Free to download and use with a seamless, familiar user interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel ask to save a read-only file?

Excel may prompt you to save a read-only file if the workbook contains volatile functions (like TODAY or RAND) that recalculate upon opening, if background macros modify the sheet, or if recent application updates alter default AutoSave behaviors.

Will the Auto_Close macro affect my other open workbooks?

No. The command 'ThisWorkbook.Saved = True' specifically targets the single workbook where the VBA module is stored. Any other open Excel workbooks will still prompt you to save if there are unsaved changes.

How do I hide a workbook in Excel?

To hide an active workbook, navigate to the 'View' tab on the Excel ribbon and click 'Hide' in the Window group. This keeps the workbook open in the background (ideal for macro toolboxes) without cluttering your workspace.