Disabling the "want to save your changes?" dialogue box when closing out of Excel

ktielens

New Member
Joined
Oct 26, 2015
Messages
23
I have a workbook that is stored as read only on a SharePoint site. Users are unable to save the document (save as is allowed), but when closing out of the document, the dialogue box still shows saying "Want to save your changes to [file name]" with options of "save" "don't save" and "cancel".

Is there a way to disable this box from appearing? It only serves to confuse the users. Upon closing I would like the document to close without any kind of save or notification regarding saving.

Thank you in advance.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I don't see why it should be confusing -- if they choose Save, they will see the SaveAs dialog. Better that than fat-fingering Close and losing work, IMO.
 
Upvote 0
Add the following to the ThisWorkbook module:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)

ThisWorkbook.Saved = True


End Sub

The code does not save the workbook; it just makes it look like it's saved.
 
Upvote 0
The above is not working or maybe I just don't understand where to put it in the VBA. I've tried putting it in a module as described on the Microsoft site, as well as in a "this workbook" beforeclose. It works (the dialogue box does not show) upon the first close but when I go back in, make some changes and x out the box shows back up again.
 
Upvote 0
Add the following to the ThisWorkbook module:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

The code does not save the workbook; it just makes it look like it's saved.


Thank you so much for the specific direction (put it in the thisworkbook module). Worked like a charm!!
 
Upvote 0
You might want to make the code to check both the path and file name match the original path and file name bef ore the Saved property becomes true. This way the workbook asks about saving if they've already saved it to another location / filename.
 
Upvote 0
You might want to make the code to check both the path and file name match the original path and file name bef ore the Saved property becomes true. This way the workbook asks about saving if they've already saved it to another location / filename.

That's a great idea. Do you have any suggestions regarding where I can look for that type of code? I am a VBA newbie, if it wasn't obvious.
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

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