Companion file when there are 2 excel instances

alain_m

New member
Hello,

I am using XLS Padlock to secure an excel file.
In the VBA code of this file I am using the following lines to have a second instance of Excel and open with it another excel file. This other file is included in the EXE as a companion file.
See below VBA code :

Dim appExcel As Excel.Application
Dim wbExcel As Excel.Workbook
Dim wsExcel As Excel.Worksheet


another_file = PathToFile(“another.xls”)

Set appExcel = CreateObject(“Excel.Application”)
Set wbExcel = appExcel.Workbooks.Open(another_file, False, True)
Set wsExcel = wbExcel.Worksheets(“Sheet1”)


where PathToFile is coming from XLS Padlock manual:

Public Function PathToFile(Filename As String)
Dim XLSPadlock As Object
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns(“GXLSForm.GXLSFormula”).Object
PathToFile = XLSPadlock.PLEvalVar(“XLSPath”) & Filename
Exit Function
Err:
PathToFile = ""
End Function

However it seems that second instance of Excel is not able to reach the companion file in its virtual location.
I confirm that the first instance of excel (the secured EXE) can access to it.
Is there a way to fix this and enable the second excel instance to also access the virtual location?

Regard,

Alain
 
Back
Top