Article ID: 161245
Article Last Modified on 10/11/2006
Dim X As Boolean
Sub Test_Workbook_Protection()
X = False
If ActiveWorkbook.ProtectWindows Then X = True
If ActiveWorkbook.ProtectStructure Then X = True
If X = False Then
MsgBox "The workbook is not protected."
Else
MsgBox "The workbook is protected."
End If
End Sub
Sub Test_Worksheet_Protection()
X = False
If ActiveSheet.ProtectContents Then X = True
If ActiveSheet.ProtectDrawingObjects Then X = True
If ActiveSheet.ProtectScenarios Then X = True
If X = False Then
MsgBox "The worksheet is not protected."
Else
MsgBox "The worksheet is protected."
End If
End Sub
163435 VBA: Programming Resources for Visual Basic for Applications
protecting, worksheets and workbooks
protecting documents
Additional query words: XL97 8.00 XL98 XL7 XL5 XL
Keywords: kbdtacode kbprogramming KB161245