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





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top