View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Macro to protect and unprotect

Hi
try something like:
Sub Macro12()
'
' Macro12 Macro
' Macro enregistrée l
Activesheet.unprotect password:="your_password"
' some code

ActiveSheet.Protect password:="your_password",
DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


tetreaultl wrote:
I want to protect and unprotect a excel sheet with a macro, how do I
pass the password to the command?

Sub Macro12()
'
' Macro12 Macro
' Macro enregistrée l
'

'
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub