title: Test if a workbook contains password protected chart sheets
body: <p>I am using this code to test whether worksheets are password protected in the specified workbook <code>objXL</code>.</p>
  
  <pre><code>Function IsProtected(objXL As Object) As Boolean
  Dim wksht As Excel.Worksheet
  Dim cell As Excel.Range
  Select Case TypeName(objXL)
  Case "Worksheet"
  If objXL.ProtectContents Then
  IsProtected = True
  Exit Function
  End If
  Case "Workbook"
  If objXL.ProtectStructure Then
  IsProtected = True
  Exit Function
  End If
  For Each wksht In objXL.Worksheets
  If wksht.ProtectContents Then
  IsProtected = True
  Exit Function
  End If
  Next wksht
  Case "Range"
  If objXL.Cells.Count = 1 Then
  If (objXL.Locked And objXL.Parent.ProtectContents) Or (IsProtected(objXL.Parent.Parent)) Then
  IsProtected = True
  Exit Function
  End If
  Else
  For Each cell In objXL
  If (cell.Locked And cell.Parent.ProtectContents) Or (IsProtected(cell.Parent.Parent)) Then
  IsProtected = True
  Exit Function
  End If
  Next cell
  End If
  
  End Select
  End Function
  </code></pre>
  
  <p>The function fails to detect chart sheets that are password protected. Any ideas how I can modify this?</p>