XL 2007 VBA not recognizing .ProtectContents properly

E

EagleOne

2003/2007

Below is a VBA snippet that worked fine in 2003.

With 2007, the code below does not consistently sensing if
wks.ProtectContents = True, therefore,
wks.Unprotect Password:="12345678" is bypassed.

Any thoughts or workarounds?

EagleOne

For Each wks In MyPreviousWorkBook.Worksheets
wks.Activate
If wks.ProtectContents = True Then
wks.Unprotect Password:="12345678"
End If
Next wks
 
Top