XLS Padlock can protect one workbook per EXE file. If your workbook uses external references or requires additional files (or even workbooks), you’ll have to update it to make it compatible with XLS Padlock.
XLS Padlock provides you with several ways to access additional resource or source files:
Add them as Companion files (see Add Companion Files).
Use hyperlinks or references with VBA code.
XLS Padlock offers an Excel function to retrieve paths to external files. This function is called PLEvalVar and can be called directly from Excel or with VBA code.
This function takes one argument in string format:
=PLEvalVar("EXEPath") returns the full path to the folder that contains the application EXE file (and trailing backslash).
=PLEvalVar("XLSPath") returns the full path to the folder that contains the compiled workbook at runtime (and trailing backslash). Note that this folder is a virtual folder and thus, you can’t place real files into it. It’s useful only if you work with Companion files (see Add Companion Files).
You have hyperlinks to external image files. These image files are in the same folder as the workbook XLS file (or in a sub folder).
You have a hyperlink in a cell which is defined by:
To make it working with XLS Padlock, you must copy all external image files in the same folder as the EXE file built with XLS Padlock. Then, you have to modify all hyperlinks to insert the PLEvalVar("EXEPath") function that returns the path to that folder.
In our case, this will become:
External files must be deployed in the same folder as the application EXE file. Do not use spaces in filenames!
For compatibility, at design time, the PLEvalVar("EXEPath") function returns the path to the folder that contains your workbook source file. So that hyperlinks still work if you insert the function.
Note: if you have sub folders, it will work too:
has to be replaced by:
You want to access external files with VBA code. Remember that external files must be in the same folder as the EXE file. You can use this code:
Public Function PathToFile(Filename As String)
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns("GXLSForm.GXLSFormula").Object
PathToFile = XLSPadlock.PLEvalVar("EXEPath") & Filename
PathToFile = ""
If you pass Myfile.ext to this function, it returns the full path to the file, provided that the file is in the same folder as the EXE file.
Copyright © 2022 G.D.G. Software