If your workbook is linked to other workbooks or data sources, you can add these as “companion files.” This bundles them directly into the main application EXE, making distribution easier. When the application runs, these files are made available in the same virtual folder as the main workbook.
You can even include XLL add-ins.
For example, if your workbook uses an external text file as a data source, adding it as a companion file ensures it will always be found when the compiled workbook is opened on any computer.

To add files, click Add Files and select them. They will appear in the list. The “Storage Filename” column shows the filename that will be used when the file is compiled into the EXE and restored at runtime.
Avoid Large Files
Do not add very large files, as they will be stored entirely in memory. For linking to other large workbooks or data files, it is better to place them in the same folder as your application EXE and reference them using the PLEvalVar("XLSPath") function. See Use External References and Hyperlinks for more details.
Accessing Companion Files with VBA #
To access companion files with VBA, you can use the following function:
Public Function PathToCompiledFile(Filename As String) As String
Dim XLSPadlock As Object
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns("GXLSForm.GXLSFormula").Object
PathToCompiledFile = XLSPadlock.PLEvalVar("XLSPath") & Filename
Exit Function
Err:
PathToCompiledFile = ""
End FunctionYou can then use this function to open a companion file:
Sub ExampleUsage()
Dim wk As Workbook
Dim filePath As String
filePath = PathToCompiledFile("Test File.xlsx")
If filePath <> "" Then
Set wk = Workbooks.Open(filePath, False, False)
MsgBox wk.Sheets(1).Cells(1, 1).Value
wk.Close
Else
MsgBox "Companion file not found!"
End If
End Sub
