ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   XL 2007 VBA not recognizing .ProtectContents properly (https://www.excelbanter.com/excel-discussion-misc-queries/139738-xl-2007-vba-not-recognizing-protectcontents-properly.html)

[email protected]

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


All times are GMT +1. The time now is 06:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com