P
paul.robinson
Hi
Trying to answer a post for someone else and have come down to this.
I have a sheet called InputDetails. I save the file which calls the
sub rspProtectInputSheet from the BeforeSave event.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Call rspProtectInputSheet
End Sub
Public Sub rspProtectInputSheet()
Dim password As String 'This line of code is optional
password = "xxxx"
Worksheets("InputDetails").Cells.Locked = True
Worksheets("InputDetails").Protect password, contents:=True, _
Userinterfaceonly:=True, AllowFormattingColumns:=False
End Sub
I now have InputDetails password protected. I can save the file again
without a problem. I can unprotect the sheet, edit it and save and
again the sheet is protected.
Now I close the file and reopen it. When I save I now get an error
"Unable to Set the Locked Property of the Range class" with the line
Worksheets("InputDetails").Cells.Locked = True
highlighted.
Any ideas why this happens??
regards
Paul
Trying to answer a post for someone else and have come down to this.
I have a sheet called InputDetails. I save the file which calls the
sub rspProtectInputSheet from the BeforeSave event.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Call rspProtectInputSheet
End Sub
Public Sub rspProtectInputSheet()
Dim password As String 'This line of code is optional
password = "xxxx"
Worksheets("InputDetails").Cells.Locked = True
Worksheets("InputDetails").Protect password, contents:=True, _
Userinterfaceonly:=True, AllowFormattingColumns:=False
End Sub
I now have InputDetails password protected. I can save the file again
without a problem. I can unprotect the sheet, edit it and save and
again the sheet is protected.
Now I close the file and reopen it. When I save I now get an error
"Unable to Set the Locked Property of the Range class" with the line
Worksheets("InputDetails").Cells.Locked = True
highlighted.
Any ideas why this happens??
regards
Paul