|
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 = True End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Me.Save End 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 = True End Sub Sub No_Save() ThisWorkbook.Save ''or 'ActiveWorkbook.Save End 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:=False End 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. ALL purchases 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
Excel Trader Package Technical 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