Purpose: create other Excel instances and access secure workbook and companion files

By default, only the Excel instance run by the compiled workbook EXE file is allowed to access the workbook file and its companion files (if any).

If you start another Excel instance from VBA, it can’t access the secure workbook file unless you use the following VBA code to allow access.

Sub RunOtherExcel()
Dim XLSPadlock As Object
Set XLSPadlock = Application.COMAddIns("GXLS.GXLSPLock").Object
another_file = PathToCompiledFile("data.xlsx")
' Start a new Excel instance
Set appExcel = CreateObject("Excel.Application")
' Tell XLS Padlock to grant access to virtual files in new Excel instance
Dim Res As Long
Res = appExcel.Application.Hwnd
XLSPadlock.SetOption Option:="5", Value:=Res
' The new Excel instance can now work with virtual workbook files:
Set wbExcel = appExcel.Workbooks.Open(another_file, False, True)
Set wsExcel = wbExcel.Worksheets("Sheet1")
MsgBox (wsExcel.Cells(1, 1).Value)
' Done, be sure to quit the application.
' Release the object variable.
Set appExcel = Nothing