3
votes

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.

Enable Editing button

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.

Unable to unlock

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

2
fwiw, I do not experience this behavior on a new Excel 2013 workbook but did on yours (even after Unblocking with Explorer, Right-click, Properties). The only way I could access the Freeze/Unfreeze command was to copy the worksheet to a new workbook.user4039065

2 Answers

1
votes

The workbook may be partially unprotected but it retains a digital signature.

        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).

0
votes

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 .