Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Qualifying permissions in protect unprotect macro.
HI All I wonder if someone can help with a small puzzle. I use this macro to protect / unprotect the sheets in my workbook : Sub Protect_Unprotect() Const PWORD As String = "Password" Dim wkSht As Worksheet Dim statStr As String For Each wkSht In ActiveWorkbook.Worksheets With wkSht statStr = statStr & vbNewLine & "Sheet " & .Name If .ProtectContents Then wkSht.Unprotect Password:=PWORD statStr = statStr & ": Unprotected" Else wkSht.Protect Password:=PWORD statStr = statStr & ": Protected" End If End With Next wkSht MsgBox Mid(statStr, 2) End Sub I'm trying to add into the code these qualifying permissions when the macro protects and unprotects : DrawingObjects:=False, _ Contents:=True, _ Scenarios:=True, _ AllowFormattingCells:=True, _ AllowFormattingColumns:=True, _ AllowFormattingRows:=True, _ AllowFiltering:=True I can't seem to place these in the correct place in the code without errors. Can someone advise where the code should be placed so that it works? Grateful for any advice. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Protect and Unprotect all worksheets with macro | Excel Discussion (Misc queries) | |||
Macro to Protect OK, Unprotect now messed up! | Excel Worksheet Functions | |||
400 Error in Unprotect/Protect Macro | Excel Discussion (Misc queries) | |||
Code to protect/unprotect a sheet using a macro with password | Excel Discussion (Misc queries) | |||
protect / unprotect VBA project by macro | Excel Discussion (Misc queries) |