Purpose: getting EXE File Version and Product Version

XLS Padlock lets you set the file version and product version of the EXE file, as explained in EXE version info.

If you want to retrieve these two values in your workbook with VBA code, use the following one:

Public Function ReadProductVersion()
Dim XLSPadlock As Object
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns("GXLSForm.GXLSFormula").Object
ReadProductVersion = XLSPadlock.PLEvalVar("ProductVersion")
Exit Function
Err:
ProductVersion = ""
End Function
 

 

You can then call the function:

Sub Test_ProductVersion()
   MsgBox ReadProductVersion()
End Sub
 

 

The same works for File Version. Just replace ProductVersion by FileVersion as:

… = XLSPadlock.PLEvalVar("FileVersion")