Syntax for WorkSheet Protection details

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

Using Office 97 (and 2003)

What is the code to test for "True" "False" status of:

ActiveSheet.ProtectContents AllowFormattingCells:

I need other details but assume that the others will follow suit.


What I want to do is save to Boolean Dimed variable(s) the original status of each
aspect of the WS protection choices.

Then, before I close the macro, re-set the WS to the original Protection status
after use of:
ActiveSheet.Protect UserInterfaceOnly:=True

is Boolean the best Dimension or should I use Variant or ??


TIA Dennis
 
Hi Dennis!

Here's applied syntax you want:

Sub test()
If ActiveSheet.ProtectContents = True Then
MsgBox "Protected"
Else
MsgBox "Not Protected"
End If
If ActiveSheet.Protection.AllowFormattingCells = True Then
MsgBox "Formatting allowed"
Else
MsgBox "Formatting not allowed"
End If
End Sub

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
Back
Top