Purpose: retrieve number of remaining days in trial with VBA

The following VBA code lets you retrieve the number of remaining days for a trial workbook. It will also work for non-trial keys if your key has an expiration date or number of runs.

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


You can then call the function:

Sub Test_Trial()
 rdays = ReadTrialState() 
 Worksheets("Sheet1").Range("A1").Value = rdays
End Sub