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.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
8,053
Office Version
  1. 365
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
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
I don't suppose anyone knows what the code would be in Word??
 

Forum statistics

Threads
1,171,525
Messages
5,876,012
Members
433,166
Latest member
ExcelPowerUserWannabe

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