Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if protected
How do you tell if the active file workbook protect is activated? For Sheet
protect test I have used: If ActiveSheet.ProtectContents = True Then ............ For the Workbook I tried: If ActiveWorkbook.ProtectContents = True Then .......... But that does not work. Thanks for your help, Steven |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if protected
Just run
ActiveWorkbook.Protect Contents:= true or ActiveWorkbook.Protect Contents:= true password:= "passkey" then you know it is. and ActiveWorkbook.Unprotect or ActiveWorkbook.Unprotect Password:= "passkey" when you need to unprotect it. Do you really need to query the status? You could try to change the value of a cell you know should be locked and intercept the error if Protection is enabled. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if protected
This works too and can be modified to check different criteria;
Sub CheckProtection() ActiveSheet.Protect ' Check the ability to insert columns on a protected sheet. ' Notify the user of this status. If ActiveSheet.Protection.AllowInsertingColumns = True Then MsgBox "The insertion of columns is allowed on this protected worksheet." Else MsgBox "The insertion of columns is not allowed on this protected worksheet." End If End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if protected
Steven,
If ActiveWorkbook.ProtectStructure Or ActiveWorkbook.ProtectWindows Then Debug.Print "workbook is protected" Else Debug.Print "workbook not protected" End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Steven" wrote in message ... How do you tell if the active file workbook protect is activated? For Sheet protect test I have used: If ActiveSheet.ProtectContents = True Then ............ For the Workbook I tried: If ActiveWorkbook.ProtectContents = True Then .......... But that does not work. Thanks for your help, Steven |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Edit text format in non-protected cells in protected worksheet | Excel Discussion (Misc queries) | |||
Calculate mean of test scores from rows of test answers | Excel Discussion (Misc queries) | |||
Group, Outline, Protected Worksheets and Protected Workbook | Excel Programming | |||
test..where are my messages..test | New Users to Excel | |||
Copy of protected document was unprotected in 97 and protected in 2002 | Excel Programming |