LockXLS On-line Help Library

Welcome
Getting Started
Using LockXLS
How to ...
General Questions
Questions about LockXLS activation
Advanced Questions
LockXLS Runtime Menu
Samples
About LockXLS
Purchase
Contact
Access to registration information from VBA macro

Access to registration information from VBA macro.

LockXLS allows to get registration information about locked workbook using VBA macro. For example this code shows, was Activation Code entered, or not:

' declare variable for LockXLS Runtime object
Dim oLockXLS As Object
' create LockXLS Runtime object
Set oLockXLS = CreateObject("LockXLSRuntime.Connect")
' display True or False using MsgBox
MsgBox oLockXLS.GetActivationInfo (ThisWorkbook, "registered")
' release LockXLS Runtime object
Set oLockXLS = Nothing

Method LockXLSRuntime.GetActivationInfo( <workbook>, <option> ) may receive the following options:

  • registered - returns True if Activation code has been entered and False, if not.
  • working_period - returns working period of this workbook - how many days this workbook will work on customer's PC.
  • usage_period - returns count of days passed from first opening of this workbook.
  • serial_number - returns serial number, used to activate this workbook.
  • customer_id - returns customer ID, used to activate this workbook.
This method returns information only for workbooks protected with Activation Code or with Serial Number protection options.

Method LockXLSRuntime.IsWorkbookActivated( <workbook> ) returns True if this workbook has been successfully activated. This is same function as GetActivationInfo with "registered" option.

Method LockXLSRuntime.IsWorkbookLocked( <workbook> ) returns True if this workbook object represents workbook protected with LockXLS. You can use this method to distinguish locked and unlocked versions of your workbooks.

Method LockXLSRuntime.GetComputerCode( <options> ) returns Computer Code for this PC. Possible such values for options:

  • 1 - use CPU to generate Computer Code
  • 2 - use HDD to generate Computer Code
  • 4 - use Network Adapter to generate Computer Code
You can use any of these values or combination of them. For example, GetComputerCode(1 + 2) returns Computer Code generated for CPU and HDD only.

You can use this technique to limit functinality of your workbook during trial period. If GetActivationInfo function with registered option returns FALSE - you workbook is in trial period.

This example shows how to access Serial Number and Customer ID:

' declare variable for LockXLS Runtime object
Dim oLockXLS As Object
' create LockXLS Runtime object
Set oLockXLS = CreateObject("LockXLSRuntime.Connect")
' display Serial Number and Customer ID
Sheets("Sheet1").Range("K3") = oLockXLS.GetActivationInfo(ThisWorkbook, "customer_id")
Sheets("Sheet1").Range("K4") = oLockXLS.GetActivationInfo(ThisWorkbook, "serial_number")
' release LockXLS Runtime object
Set oLockXLS = Nothing

See Also

All methods of the LockXLS Runtime object

Review Runtime Functions example which shows usage of these macros