Reputation: 129
I have a problem with my macro which is failed on attempt to UnfreezePanes. The document has structure protection: View > Protect Workbook > Structure and windows protection (for 2013 version)
In excel versions before 2013 I do not have problems with the macro:
Sub Unfreeze()
ActiveWorkbook.Unprotect
ActiveWindow.FreezePanes = False
End Sub
But in 2013 version I faced a problem when 'ActiveWorkbook.Unprotect' is executed without errors but does not cancel structure change restrictions from the document because the newt row ActiveWindow.FreezePanes = False
throws :
error 1004 'Application-defined or object-definited error'.
Moreover FreezePanes button on the Ribbon is locked even after pressing the button 'Enable Editing' which popups each time when I open the document.
After pressing the button 'Enable editing' I go to VBE and execute 'ActiveWorkbook.Unprotect' and then I still see the document is protected: View > Protect Workbook > Structure is checked. So my attempts to remove the protection not directly from this window are failed. But! I am not able to remove the protection even from this window! When I uncheck the checkbox 'Structure' the button [Ok] becomes unavaileble! The protection does not have a password because even when I type some symbols in the password field a still unable to press [Ok] button while 'Structure' checkbox is unchecked.
Please note the problem is reproducible in excel 2013 and it will be great if you advice how to unlock the document using vba code.
Example of the document can be found here
Upvotes: 3
Views: 1689
Reputation:
The workbook may be partially unprotected but it retains a digital signature.
Click File ► Info ► Protect Workbook ► Add a digital signature for details. Changing it or removing it altogether quickly recovered the ability to Freeze/Unfreeze pane(s).
Upvotes: 1
Reputation: 81
With excel files from previous versions of excel I have had activesheet.unprotect change the activesheet in E2013.
Maybe if you try qualifing the call to unprotect with the workbook name and the same with the freezepanes call?
I have not tested it .
Upvotes: 0