check if protected

  • Thread starter Thread starter Lloyd
  • Start date Start date
L

Lloyd

Does anyone know a code snippet that will suffice to
check whether or not a worksheet is protected?

I've begun using the following code which checks the
ProtectScenarios property, however, am not sure if this
really is appropriate, since I've not set up any
scenarios in the workbook, and am concerned about the
possibility of unpredictable behavior.

If Worksheets("myWorksheet").ProtectScenarios Then
MsgBox "This workship is protected."
Else
MsgBox "Sheet is not protected"
End If

Thanks for any suggestions.

Lloyd
 
If Worksheets("myWorksheet").ProtectScenarios or _
Worksheets("myWorksheet").ProtectDrawingObjects or _
Worksheets("myWorksheet").ProtectContents Then
MsgBox "This workship is protected."
Else
MsgBox "Sheet is not protected"
End If
 
Thanks a lot, Tom.

Much appreciated.

Lloyd
-----Original Message-----
If Worksheets("myWorksheet").ProtectScenarios or _
Worksheets("myWorksheet").ProtectDrawingObjects or _
Worksheets("myWorksheet").ProtectContents Then
MsgBox "This workship is protected."
Else
MsgBox "Sheet is not protected"
End If

--
Regards,
Tom Ogilvy





.
 
Back
Top