<<Convert Excel Spreadsheets to Web Pages | Trading Software That Operates Within Excel | Convert Excel, Access & Other Databases | Merge Excel Files>>
Ozgrid, Experts in Microsoft Excel Spreadsheets

Prevent Save Prompts in Excel

| | Information Helpful? Why Not Donate.

TRY OUT: Smart-VBA | Code-VBA | Analyzer-XL | Downloader-XL | Trader-XL| More Free Downloads.. Best Value: Finance Templates Bundle

Excel VBA: Stop/Prevent Save Prompts in Excel Workbooks

Current Special! Complete Excel Excel Training Course for Excel 97 - Excel 2003, only $145.00. $59.95 Instant Buy/Download,30 Day Money Back Guarantee & Free Excel Help for LIFE!

Got any Excel Questions? Free Excel Help

Stop/Prevent Save Prompts in Excel. See Also:  Prevent Save As in Excel and/or Stop Do You Want To Save Changes when there are none!

There are times when you m ay wish to prevent any "Save" prompts when closing an Excel Workbook manually, or via Excel VBA code. This can be achieved in a number of ways depending on your desired outcome.

Stop/Prevent Save Prompts in Excel & Don't Save, Or Save

If your desired outcome is to NOT save changes, use the first of the codes below. If your desired outcome is to save changes, use the second of the codes below.

Private Sub Workbook_BeforeClose(Cancel As Boolean)    Me.Saved = TrueEnd SubPrivate Sub Workbook_BeforeClose(Cancel As Boolean)    Me.SaveEnd Sub

One of these codes MUST reside in the Private Module of the Workbook Object (ThisWorkbook). To get there from Excel, left click on the Excel icon, top left next to File and choose "View Code". Paste the code in here. The first simply tricks Excel into thinking the Workbook has been saved. The second forces Excel to always save automatically before closing. You cannot use both Procedures together.

Sub No_Save()    ThisWorkbook.Saved = True    ''or    'ActiveWorkbook.Saved = TrueEnd SubSub No_Save()    ThisWorkbook.Save    ''or    'ActiveWorkbook.SaveEnd Sub

The above code is the same as the Workbook_BeforeClose Procedures shown above. The only difference is, they must reside in a standard module (Insert>Module).

Sub Close_No_Save()    ThisWorkbook.Close SaveChanges:=False    ''or    'ActiveWorkbook.Close SaveChanges:=FalseEnd Sub

The Close_No_Save Procedure above will close Excel and not save any changes made. To force a save change False to True.

Excel Dashboard Reports & Excel Dashboard Charts 50% Off Become an ExcelUser Affiliate & Earn Money

Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALLpurchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to [email protected] 31 days after purchase date.


Instant Download and Money Back Guarantee on Most Software

Try out:Analyzer XL |Downloader XL |Smart VBA |Trader XL Pro (best value) |ConsoXL | MergeXL | O2OLAP for Excel | MORE>>

Excel Trader PackageTechnical Analysis in Excel With $139.00 of FREE software!

Microsoft � and Microsoft Excel � are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft

Some of our more popular products are below...
Convert Excel Spreadsheets To Webpages | Trading In Excel | Construction Estimators | Finance Templates & Add-ins Bundle | Code-VBA | Smart-VBA | Print-VBA | Excel Data Manipulation & Analysis | Convert MS Office Applications To...... | Analyzer Excel | Downloader Excel | MSSQL Migration Toolkit | Monte Carlo Add-in | Excel Costing Templates