VBA Close Workbook Without Saving: Skip the Save Prompt
The vba close workbook without saving pattern uses SaveChanges:=False to shut a file the moment a macro is done with it — no save dialog, no click-through, no interruption when you are batch-closing a dozen month-end files in a row.

ACA | FMVA® | 19 Years in Finance
This guide is part of the FinDataPro Excel VBA Workbook Events series.
The SaveChanges:=False Pattern
Run this from any standard module:
Option Explicit
Sub CloseWithoutSaving()
Dim wb As Workbook
Set wb = Workbooks("MonthEnd_June.xlsx")
' Discard any unsaved edits and close immediately
wb.Close SaveChanges:=False
End SubSaveChanges:=False tells Excel exactly what to do with unsaved changes, so it never has to ask.
Download the Example Workbook — Free
The working .xlsm file with both macros already wired up — open it, inspect the code in a standard module, and adapt the workbook name to your own file.
Where the Code Goes
This runs from a standard module, not an event handler — you are calling Workbooks.Close deliberately from another macro, not reacting to the user clicking Close. Contrast this with Workbook_BeforeClose, which intercepts the user's own close action instead.
Finance Use Case: Batch-Closing Month-End Files
A month-end close often means opening, printing or exporting, then closing a dozen departmental files in sequence. Each one triggers a save prompt the moment a formula recalculates a volatile function — even when nothing meaningful changed. Wrapping the close in SaveChanges:=False removes that friction entirely, as long as you know the file's content is already final.
The volatile-function trigger catches people out more than they expect. Functions like TODAY(), NOW(), or any function referencing external data recalculate every time the workbook is touched, which Excel then treats as an unsaved change even though no cell value the user cares about has actually moved. A finance team running the same batch-close routine every month ends up training itself to click through a save prompt that never carries real information — exactly the kind of repetitive, meaningless confirmation a macro should remove rather than automate around.
Closing Every Open Workbook Except One
To close every workbook except the one running the macro:
Option Explicit
Sub CloseAllExceptThis()
Dim wb As Workbook
For Each wb In Application.Workbooks
If wb.Name <> ThisWorkbook.Name Then
wb.Close SaveChanges:=False
End If
Next wb
End SubLooping backwards is unnecessary here since each closed workbook is simply removed from the collection as the loop continues to the next item.
Common Mistakes
Most problems with this pattern come from treating it as a blanket close-everything switch rather than a deliberate, scoped decision about one specific file at a time.
- Using
SaveChanges:=Falseon a file with genuinely unsaved work — always confirm the file is truly done first. - Forgetting
wb.Namecomparisons are case-insensitive but path-sensitive — comparing against a full path when only a name was captured silently fails to match. - Assuming
SaveChanges:=Trueforces a save without first checking the file has a valid save path — a brand-new unsaved workbook still triggers the Save As dialog. - Not pairing this with a check that the workbook is actually open before calling Close on it.
Related Guides on This Series
To build the working file list first, see Loop Through Worksheets for the consolidation pattern, or Check If Workbook Is Open to avoid closing a file another macro still needs.
Full reference: Microsoft Learn Workbooks.Close method reference.
Frequently Asked Questions
What does SaveChanges:=False actually do?
It discards unsaved edits and closes the workbook without the save prompt. Use SaveChanges:=True for the opposite.
Does this work on a file that was never saved?
Yes — it discards the in-memory state and closes regardless of whether the file already had saved content.
How do I close every workbook except this one?
Loop through Application.Workbooks, skip the one matching ThisWorkbook.Name, and close the rest.
Is there a data-loss risk?
Only if the file holds edits you wanted. Use this only on files already exported, printed, or otherwise finished.
Conclusion
SaveChanges:=False turns a dozen manual save-prompt clicks into one silent, deliberate close. Add it to your month-end batch macro once the file's content is confirmed final, and pair it with a workbook-open check so you never close a file mid-use.

Prashant Panchal is a Chartered Accountant (ACA) and Financial Modelling & Valuation Analyst (FMVA®) with 19 years of experience in finance, FP&A, and financial modelling across the GCC region. He is the founder of FinDataPro.
Discussion
Leave a Comment
Comments are moderated and appear once approved.
