Excel crashes after opening an unprotected workbook with VBA


We are using XLS Padlock v2.4 to protect our VBA application. Recently a customer pointed out that Excel crashes after he opens a macro enabled workbook in combination with the protected XLS Padlock application. We have been able to pin it down and reproduce this by the following steps.

  • Create a new Excel workbook.

  • Open the VBA editor and add the following two lines to the “ThisWorkbook” section.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    End Sub

  • Save the Excel workbook as an macro enabled workbook, e.g. Book1.xlsm.

  • Close Excel
  • Start the protected (XLS Padlock) workbook/application (myapp.exe)
  • Open Book1.xlsm

Excel will start producing the following errors.

  1. Can’t move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
  2. OLE 800A03EC (this one keeps repeating until Excel crashes)

What is the cause of this error and how can this be prevented?

Best regards,
Arthur Borsboom.

Thank you for the bug report. The VBA event seems to be the culprit.
You can prevent it with the following option:

As an alternative, your customer can open another Excel instance before opening Book1.xlsm

I have tried the option “Do not allow loading/save other workbooks”, but it does not give the result I was hoping for. This is what happens now.

  • Start the protected application ‘myapp.exe’ with the setting ’ Do not allow …’; Excel opens as expected.
  • Open a new unprotected Excel from the Windows desktop, e.g. ‘Book1.xlsm’.

This gives the following error, which I am sure, customers don’t understand why their Excel is ‘not working’ anymore.

Am I doing something wrong? Or better, how can I make sure the workbook opens normally?

See the other related thread

For other people visiting this thread: