Retrieve Expiration Date using VBA

jampayeshe

New member
The user should always have up-to-date information about how many days are left before the license ends.
In this case, you have provided the following code:

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

You can then call the function:

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

But even if you apply these functions without changes, then 0 is always displayed in cell A1.
Thus, it is generally unclear how the functions you specified can help if they do not work.
When you start the file, a Display Nag Screen appears, where the number of remaining days is shown. But macros don’t work.

I haven’t been able to get an answer to this question for more than a month. The support service does not respond to clarifying questions on this topic.
 
jampayeshe said:
clear how the functions you specified can help if they do not work.
When you start the file, a Display Nag Screen appears, where the number of remaining days is shown. But macros don’t work.

I haven’t been able to get an answer to this question for more than a month. The support service does not respond to clarifying questions on this topic.
Macros do work as expected. Several tests were made again and ReadTrialState works as expected.
image

If the function returns nothing, try to remove the “On Error GoTo Err” to see if an error occurs (at runtime).
 
The reason turned out to be that macros only work when Display Nag is disabled.
And if you activate Display Nag, the macros do not work. But this was not written in the instructions.
 
Last edited:
That’s strange. We made several tests, including the option “Display Nag”. And, in all cases, it works. We’ll have to double-check again.
 
Back
Top