ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   check if protected (https://www.excelbanter.com/excel-programming/291420-check-if-protected.html)

Lloyd

check if protected
 
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

Tom Ogilvy

check if protected
 
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


"Lloyd" wrote in message
...
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




Lloyd

check if protected
 
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


"Lloyd" wrote in

message
...
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



.



All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com