Unexpected Error while loading protected workbook when opening file via VBA

I am receiving the Error Message: Unexpected error while loading protected workbook: Sorry we couldn’t find r:\Office\3G36T\SystematicRiskManager v1.210.3.154.xlsm. Is it possible that it was moved, renamed or deleted? Please restart the protection program.

When I try to load a compiled save file via VBA.

I have a fairly complicated Excel application (c. 55k lines of code, c.30 worksheets, RTDs, forms and formulas etc). Because of this complexity, I have previously tried to implement saving selected sheets, ranges, cells with XLSPadlock, but it was not useable (18 months ago it crashed everytime so I gave up) and now is not feasible, as software updates may mean saved formulas, cells, ranges, names or even sheets may be moved or removed. For this reason, I am managing all loading and saving trough VBA, with inbuilt code to create my own data export/imports when a new version has been installed, but also saving the compiled file on every close.

On this basis, if the user is opening the same app version as last time, I want to automatically open the last compiled save file, created with the XLS Padlock VBA code:

Set XLSPadlock = Application.COMAddIns(“GXLS.GXLSPLock”).Object
strFilename = blah blah
XLSPadlock.SaveWorkbook strFilename

Which does work, and can be opened manually with the app, so I am quite confident the save file is not corrupted.

My issue, lies in the process of opening the save file via VBA.

I have simple code on open of the application, that confirms they are not using a newer version of the app, and if so the code to open the save file is executed:

Public Sub LoadXLSPadlockSaveFile(FilePath As String)
Dim XLSPadlock As Object
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns(“GXLSForm.GXLSFormula”).Object
XLSPadlock.PLOpenSaveFile (FilePath) '<==Comment 1
ThisWorkbook.Saved = True '<==Comment 2
Application.Quit '<==Comment 3
End Sub

Comment 1: This line of code works. The application is loaded a second time, and starts to open app, but crashes before any VBA code is triggered (that I can tell)

Comment 2: I have added this, to try to force the close of the application that is loaded and trigerring the load of the save file (see Comment 3)
Comment 3: I am closing the first application, that is loaded and trigerring the load of the save file. There doesn’t seem to be any clear details, but I think there is a suggestion that you can’t have 2 instances of the app running in memory, BUT I have tried both with AND wothout calling the application.quit.

I can’t work out if I am doing something stupid, or missing the obvious, but if anyone can help it would be amazing. I hope this makes sense - 3 days into dealing with this means I’m starting to go crazy! Thank you very much in advance.

I just saw this. Try checking the option “Allow loading/saving other workbooks through VBA SetOption helper” and see if that works. Please let us know.

Thanks Steve. Frustratingly, that does not solve the problem, but thanks for the suggestion

Suggest you go to Security, Restrictions tab. Check on the following:

  1. Do you have the “Do not allow other instances of Excel when opening the protected workbook” checked?
  2. Do you have the “Only allow one instance of the protected workbook” checked?

Thanks once again, but they are both unchecked.

Does anyone know if @gdgsupport , @gdgsoft or @gdgdevsupport monitor either the support tickets, emails or these channels anymore? I logged a support ticket for this online over a week ago, and emailed them last week but have had no response. I am locked out of releasing now as I have made significant changes that are reliant on this new approach.

I am also becomming extremely nervous having an application that is entirely reliant on external software that doesn’t have a great turn around time / SLA on support issues

Are you using the Universal EXE format or not? Because the issue seems to be indeed that Excel is unable to locate the workbook file when XLSPadlock.PLOpenSaveFile is used.

I have tried with both the universal, and 64bit versions, and error occurs with both. The save file I am trying to open is saved on the C: drive, but to me it appears it is trying to open a second instance of the .exe from the temp drive/folder that is created when you open the app

Thanks for the question @gdgsupport - are you able to give any advice please? Until I am able to resolve this issue, I am unable to release an urgent and now overdue update for my app.

XLSPadlock.PLOpenSaveFile will launch a new instance of the EXE file, yes. That’s how it is designed. However, we may have identified a problem with it in recent version of XLS Padlock, and our engineer has yet to find a solution for that.

Thank you @gdgsupport for the update.
I upgraded to version 2022.1 for the webupdates functionality, however am willing to lose that temporarily, if reverting to a previous version resolves this issue - can you confirm whether that is the case please and which version I should go back to?
Can you also advise likely timescales for a solution/new release, as my project is now at a standstill until we have a solution. I am happy to take a beta version and help with testing if it will help you? Kindest Regards, Paul

Sure, first, we are trying to reproduce the issue on our own computers in order to debug it.

Happy to email you my XLSPadlock .xplp file if that would help you or provide any other details to help replicate / narrow down the issue. Just let me know anything you need from my side. Thank you