disable save on exit prompt

jgoulart

Board Regular
Joined
Feb 16, 2002
Messages
62
How can I disable the save prompt when excel is given the command to close?

John
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

Workbook.Save = True

End Sub


Put that in a module in your workbook.
 
Upvote 0
On 2002-03-17 17:12, Dreamboat wrote:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

Workbook.Save = True

End Sub

I believe dreamboat meant

ThisWorkbook.Saved=True

and placed in the Thisworkbook object

Ivan :)


Put that in a module in your workbook.
 
Upvote 0
Hi jgoulart

I think they both meant

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = Not Cancel
End Sub

This will "disable the save prompt when excel is given the command to close"

:wink:
 
Upvote 0
Sweet.

Heck, I just tested mine and it worked for me.

:)

I'll learn, Ivan & Dave. What is the difference then?
 
Upvote 0
Tuggy, you wrote

Workbook.Save=True

There isn't any such Object as "Workbook" it must be either:

"ThisWorkbook"
"ActiveWorkbook"
"Me"
"Workbooks(me.name)"

You also hade "Save" when it should be "Saved". "Save" is a Method while Saved is a Property.

The reason i suggested my method was because yours (modified by Ivan) would stop the Workbook saving at any time and not "when excel is given the command to close"
 
Upvote 0
Dave, good suggestions. I didn't know how to do this either, and nobody's suggestions worked until I looked at what you said about designating the workbook. For mine, in Excel 97, I had to put in ActiveWorkbook. It's all good now.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,268
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top