hi
I have amended quickly the code from http://www.vbaexpress.com/kb/getarticle.php?kb_id=551
Option Explicit
Public Function wbSheetsProtected(wbTarget As Workbook) As Boolean
'Macro created 07/08/2005 22:12 by Ken Puls
'Macro Purpose: To test if any worksheet in the workbook is protected
' Returns False if no sheets protected
' Returns True if one or more sheets protected
Dim ws As Worksheet
'Set function to False
wbSheetsProtected = False
'Loop through each worksheet and check for protection
For Each ws In wbTarget.Worksheets
If ws.ProtectContents = True Then
'If protected, set function to True and exit
MsgBox ws.Name & " is proctected"
Else
MsgBox ws.Name & " is unproctected"
End If
Next ws
End Function
Sub CheckProtection()
'Macro created 07/08/2005 22:14 by Ken Puls
'Macro Purpose: To test the wbSheetsProtected function
If wbSheetsProtected(ThisWorkbook) = True Then
Else
End If
End Sub
Bookmarks