Disabling Save prompt on exiting a workbook

davidrusbridge

New Member
Joined
May 14, 2011
Messages
17
Hi,

I am hoping that someone can help with some code. I have a workbook which is used by multiple users on a number of terminals. A master copy exists in a common folder with shortcuts pointing to it. I have set the workbook properties as read only.

Whenever the workbook is closed it prompts if you wish to save it which is the issue. I want to run the workbook so that when it is closed it will not prompt for Save/Save As. It just needs to close.

Any ideas will be most welcome
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You could use VBA for this - in the workbook's "ThisWorkbook" module:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End Sub
NB it needs to be in the _before close event of the "ThisWorkbook" module. Also, don't forget to save the workbook after putting in the code.
If you don't know how to do this, just post back and I'll give you easy instructions.
 
Last edited:
Upvote 0
sykes,

Thank you for the quick response and the excellent solution. It works as advertised!

I would also like to find a way of allowing the macros in the workbook to run without the security prompt on opening the workbook. I know it is possible to change the default security settings generically in Excel but I would not want to do that. I just want this one workbook to open an run without the prompt.

Any help gratefully received
 
Upvote 0
Pleasure, and thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,519
Members
452,921
Latest member
BBQKING

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