![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: John G
Posts: 62
|
How can I disable the save prompt when excel is given the command to close?
John |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
|
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Workbook.Save = True End Sub Put that in a module in your workbook.
__________________
~Anne Troy |
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
|
|
|
|
|
|
|
#4 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
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" |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
|
Sweet.
Heck, I just tested mine and it worked for me. I'll learn, Ivan & Dave. What is the difference then?
__________________
~Anne Troy |
|
|
|
|
|
#6 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
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" |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Location: Oregon
Posts: 130
|
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! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|