View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Macro for unprotecting/protecting worksheets WITH passwords

adding Password:="lockIT" does work.. note the syntax of a named
parameter..

Sub Macro1()

If ActiveSheet.ProtectContents Then
ActiveSheet.Unprotect Password:="lockIT"
Else
ActiveSheet.Protect Contents:=True, Password:="lockIT"
End If
MsgBox "Protection = " & IIf(ActiveSheet.ProtectContents, "ENabled",
"DISabled")
End Sub




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


John Baker wrote:

ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True


adding Password="xxx" does not work, and somehow the help file doesn't
help either.