View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
[email protected] EagleOne@discussions.microsoft.com is offline
external usenet poster
 
Posts: 391
Default XL 2007 VBA not recognizing .ProtectContents properly

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