D
Dave
Hi,
I have a file that is opened by a user and a macro is run to protect it so
when the file is sent out to another user, none of the cells can be selected.
The issue I am having is the macro protects the workbook but when the user
opens the workbook in Read only mode, he/she is still able to unprotect it
with out using a password. I would like the unprotect button in excel 2007 to
be grayed out when the user opens the file in read Only mode. It was my
understanding that if wrterespassword was used that the user would be
prompted to open in read only or enter the password. If the user selects read
only, they should not be able to unprotect teh workbook. Please see my code
below. What am I missing here? Any assistance is greatly appreciated.
ActiveWorkbook.Protect Password:="Password", structure:=True,
Windows:=False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowSorting:=True, AllowFiltering:=True
ActiveSheet.EnableSelection = xlNoSelection
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs FileFormat:=xlNormal, ReadOnlyRecommended:=True, _
WriteResPassword:="Password"
I have a file that is opened by a user and a macro is run to protect it so
when the file is sent out to another user, none of the cells can be selected.
The issue I am having is the macro protects the workbook but when the user
opens the workbook in Read only mode, he/she is still able to unprotect it
with out using a password. I would like the unprotect button in excel 2007 to
be grayed out when the user opens the file in read Only mode. It was my
understanding that if wrterespassword was used that the user would be
prompted to open in read only or enter the password. If the user selects read
only, they should not be able to unprotect teh workbook. Please see my code
below. What am I missing here? Any assistance is greatly appreciated.
ActiveWorkbook.Protect Password:="Password", structure:=True,
Windows:=False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowSorting:=True, AllowFiltering:=True
ActiveSheet.EnableSelection = xlNoSelection
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs FileFormat:=xlNormal, ReadOnlyRecommended:=True, _
WriteResPassword:="Password"