VBA code to change file .dat - SOLVED

Hello,
I am having a problem with some VBA functions. What I want to do is to change the .xlsc path when user move the compiled file .exe to a new folder. Therefore what I need to do is to change the path contained in the text file .dat

To get the path of current folder I am using the function of your manual “PathToFile” (see below) and it works well, but when I use the code DIR it returns always “empty”. It is like the files .dat and .xlsx do not exist but they exist in the same folder of .exe
In below code, strings “fullpathtemplate” and “fullpathtemplatexlsc” works correctly but DIR(fullpathtemplate) does not work when the Excel file is compiled by XLSPADLOCK. It works well if file is not compiled (.xlsb)

Any idea why it does not work? I have tested in 2 different PCs with the same problem. I am using last release of XLSPADLOCK with Excel 32 bits (tested in Windows 10/Excel 2016 and Windows 7/Excel 2010).

PART OF THE VBA CODE:
namewoextension = Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 5)
pathtemplate = PathToFile("")
fullpathtemplate = pathtemplate & namewoextension & ".dat"
fullpathtemplatexlsc = pathtemplate & namewoextension & “.xlsc”

TestStr = Dir(fullpathtemplate)
TestStr2 = Dir(fullpathtemplatexlsc)

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

Have you checked the values of fullpathtemplate = pathtemplate & namewoextension & ".dat"
fullpathtemplatexlsc = pathtemplate & namewoextension & ".xlsc"
with some msgbox?
What do you get?

Yes I have checked both several times. Full path strings are perfect. No problem with this.

What strings are returned? And do the files exist?

SOLVED
It was a problem of names (original excel file,file name used during compilation and rename after compilation).
The code has to be changed, it is not possible to use “thisworkbook.name” if we want the user can change name of compiled file.

Thank you for your support.

OK, thank you for the follow-up