Disable save on read only??

G

Gazz_85

is it possible for me to disable the save option on a read only file. I have
a file on the network which is shared. however when people open a read only
version and save it as a copy, then peopple are opening the copy version and
updating date, resulting in lost data and a lot of double handeling!!

any help??
 
E

Eduardo

Hi,
unfortunately if the user open as read only the file they still can save it
just changing the name. The users have to realize that doing that result in
lost data
 
L

Luke M

What Eduardo said is correct. However, if macros are enables, you can provide
reminders/hindrances. For example, if you open the VBA editor (Alt+F11) and
paste this into the ThisWorkbook module, it will cause a warning message to
appear reminding people that they can't save, and then close the workbook
without actually saving.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "You are not allowed to save this workbook", vbOKOnly, "No Saving"
ThisWorkbook.Close SaveChanges:=False
End Sub


Note that, to set this up, you need to disable macros, write this in, and
then save. Then, re-enable macros. Otherwise, your own macro will prevent you
from saving!
 
M

Mike H

Hi,

You can test for read only and prevent save if it is or allow save if it
isn't. The wheels come off though if macros aren't enabled

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveWorkbook.ReadOnly Then
MsgBox "File was opened as read-only and cannot be saved"
Cancel = True
ActiveWorkbook.Close savechanges:=False
Else
MsgBox "File was not opened as read-only and can be saved"
End If
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top