J
julief
I have a worksheet which I require to have password protected. I have set
the password up in the normal way no problem.
I then want users to be able to run a macro to select a custom view, I have
attached the following code to the macro which will allow the view to be run
without requesting a password (if the bit with password isnt in there is does
ask the user to input the password before showing the custom view).
' Sheets("sheet 2"). Unprotect Password = "mypassword"
ActiveWorkbook.CustomViews("2 - Monday View").Show
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowSorting:=True
Range("L9").Select
Sheets("sheet 2").Protect Password = "mypassword"
End Sub
However, whilst the macro appears to work it doesnt put the password back on
the worksheet. The user can just go to unprotect sheet and click on ok which
is what I need to stop.
any help would be most welcome.
the password up in the normal way no problem.
I then want users to be able to run a macro to select a custom view, I have
attached the following code to the macro which will allow the view to be run
without requesting a password (if the bit with password isnt in there is does
ask the user to input the password before showing the custom view).
' Sheets("sheet 2"). Unprotect Password = "mypassword"
ActiveWorkbook.CustomViews("2 - Monday View").Show
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowSorting:=True
Range("L9").Select
Sheets("sheet 2").Protect Password = "mypassword"
End Sub
However, whilst the macro appears to work it doesnt put the password back on
the worksheet. The user can just go to unprotect sheet and click on ok which
is what I need to stop.
any help would be most welcome.