Purpose: retrieve the activation token with VBA

XLS Padlock supports online activation for your Excel workbook app.

In some cases, you may need to know the activation token. The following VBA code allows you to get a hashsum of this activation token returned by the server on a successful activation. Note that the activation token itself is not locally stored, only its hashsum.

Use the following function to get the hashsum:


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


You can then call the function. For instance, the following code sets the value of a cell:


Private Sub Workbook_Open()
Sheet1.Range("S24") = ReturnValidationToken()
End Sub