Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to detect protected sheet
How do I detect whther a sheet is protected or not? I need the sheet
unprotected for the subroutine, but I need to know whether it was already unprotected so I can leave it in the same satte after the sub runs. -- Ian -- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to detect protected sheet
Do it the type of item being protected:
Sub dural() Dim s As Worksheet Dim t As Boolean Set s = ActiveSheet t = s.ProtectContents MsgBox (t) End Sub -- Gary''s Student - gsnu200905 "IanC" wrote: How do I detect whther a sheet is protected or not? I need the sheet unprotected for the subroutine, but I need to know whether it was already unprotected so I can leave it in the same satte after the sub runs. -- Ian -- |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to detect protected sheet
Directly from VBA help on ProtectContents Property
If Worksheets("Sheet1").ProtectContents = True Then MsgBox "The contents of Sheet1 are protected." End If Gord Dibben MS Excel MVP On Tue, 29 Sep 2009 17:15:31 +0100, "IanC" wrote: How do I detect whther a sheet is protected or not? I need the sheet unprotected for the subroutine, but I need to know whether it was already unprotected so I can leave it in the same satte after the sub runs. -- Ian |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to detect protected sheet
Thanks. I'd tried the ProtectionMode property and couldn't get it to work.
Your solution is just what I needed. -- Ian -- "Gary''s Student" wrote in message ... Do it the type of item being protected: Sub dural() Dim s As Worksheet Dim t As Boolean Set s = ActiveSheet t = s.ProtectContents MsgBox (t) End Sub -- Gary''s Student - gsnu200905 "IanC" wrote: How do I detect whther a sheet is protected or not? I need the sheet unprotected for the subroutine, but I need to know whether it was already unprotected so I can leave it in the same satte after the sub runs. -- Ian -- |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to detect protected sheet
"Gord Dibben" <gorddibbATshawDOTca wrote in message ... Directly from VBA help on ProtectContents Property If Worksheets("Sheet1").ProtectContents = True Then MsgBox "The contents of Sheet1 are protected." End If Thanks Gord. I looked at this after Gary's Student pointed me this way. It's easy when you know what keywords to look for. I'd searched for "Protect" and ProtectionMode sounded the most likely.... .....but wasn't -- Ian -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Detect existence of a sheet | Excel Programming | |||
detect and delete existing sheet | Excel Discussion (Misc queries) | |||
How to detect if sheet is hidden? | Excel Worksheet Functions | |||
Detect Password Protection on a Sheet | Excel Programming | |||
Function to detect if Sheet is protected | Excel Programming |