Cancel Save or Save as option

zoejenka

New Member
Joined
Jun 13, 2006
Messages
28
All,

I have a file that i want several people to have read only access to. I can make the file read only by putting a password onto the file. But ideally I would like to stop anyone being able to save the file as another name on their own desktop. This is to ensure that they will always be looking at the up to date version of the file.

Is there anyway I can do this?

Cheers,
Zoe.
 

Some videos you may like

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
7,994
In the ThisWorkbook module, put something like:

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) 
Cancel = True 
Msgbox "You are not allowed to save this workbook."
End Sub
 

zoejenka

New Member
Joined
Jun 13, 2006
Messages
28
Hi,

Just one query - Which I'm struggling with..

I am unable to save the code in the workbook - So when I reopen the workbook the the code is not there - Do you know a way round this?

Zoe.
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832

ADVERTISEMENT

Hi,

set a breakpoint in the code before saving (click in the margin to the left of the line cancel = true)

then skip the line "cancel = true" (get the yellow handle and move to next line) and press function key F5
or
save again while the line is still highlighted (breakmode)

kind regards,
Erik
 

zoejenka

New Member
Joined
Jun 13, 2006
Messages
28

ADVERTISEMENT

I don't suppose anyone knows what the code would be in Word??
 

Watch MrExcel Video

Forum statistics

Threads
1,123,384
Messages
5,601,320
Members
414,442
Latest member
Oleg

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
Top