ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Don't ask to save changes (https://www.excelbanter.com/excel-programming/382627-dont-ask-save-changes.html)

Shawn

Don't ask to save changes
 
What code should I use so that excel won't ask me to Save Changes? Where do
I put it?
--
Thanks
Shawn

Corey

Don't ask to save changes
 
Sub CloseandSave()
Application.DisplayAlerts = False
Application.ActiveWorkbook.Save
If Workbooks.Count 1 Then
Application.ActiveWorkbook.Close
Else
Application.Quit
End If
Application.DisplayAlerts = True
End Sub



Checks to see if anyother workbooks are opend, if YSE then SAVES & Closes without Prompt.
If ONLY workbook opened, then SAVES & QUITS Excel withoput a prompt.

Corey....

"Shawn" wrote in message
...
What code should I use so that excel won't ask me to Save Changes? Where do
I put it?
--
Thanks
Shawn



Shawn

Don't ask to save changes
 
I pasted your code into my "ThisWorkbook" object and made some chages to the
spreadsheet then clicked the "x" to close the program and it still prompted
me to save changes???
--
Thanks
Shawn


"Corey" wrote:

Sub CloseandSave()
Application.DisplayAlerts = False
Application.ActiveWorkbook.Save
If Workbooks.Count 1 Then
Application.ActiveWorkbook.Close
Else
Application.Quit
End If
Application.DisplayAlerts = True
End Sub



Checks to see if anyother workbooks are opend, if YSE then SAVES & Closes without Prompt.
If ONLY workbook opened, then SAVES & QUITS Excel withoput a prompt.

Corey....

"Shawn" wrote in message
...
What code should I use so that excel won't ask me to Save Changes? Where do
I put it?
--
Thanks
Shawn





All times are GMT +1. The time now is 02:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com