bright, fresh software
Downloads  |  Buy

Using TurboActivate with Visual Basic for Applications (VBA)

Before you can do anything you need to login to your LimeLM account (or sign up). Then download TurboActivate for Windows or Mac OS X:

Adding licensing & online activation to your appTurboActivate.dat and Version GUID

After you've created a new product, go to the version page of the product you will be adding licensing to. You will need to do 2 things:

  1. Download the TurboActivate.dat file for the product version.
  2. Make a note of the Version GUID.

You'll be including the TurboActivate.dat file in the same folder as the TurboActivate.dll or libTurboActivate.dylib files. You'll use the Version GUID in your code as part of integrating TurboActivate within your app.

Example project

Included in both the TurboActivate.zip and TurboActivate-Mac.zip packages is a simple VBA example project. The TurboActivate.bas file in the "API\VBA" folder contains all the functions you'll be using to add licensing, online-activation, and trial functionality to your app.

Special instructions for Windows

If your VBA app will be running on Windows then you'll need to use the "stdcall" version of TurboActivate (in the "stdcall" folder in the TurboActivate.zip package).

Also, if you're targeting the 64-bit version of Windows (e.g. you're app is an extension that will run in 64-bit version of Microsoft Office) then you'll need to include the x64 version of TurboActivate (from the "stdcall\x64" folder), but rename it to "TurboActivate.x64.dll". This way you can include both the x86 and x64 versions of TurboActivate and target both versions of Office without having to release 2 separate versions of your app.

Special instructions for Mac OS X

The Mac OS X versions of Microsoft Office can't load the libTurboActivate.dylib from arbitrary locations, so you'll need to make an installer that installs your VBA extension somewhere alongside the libTurboActivate.dylib and then modify the TurboActivate.bas file to hardcode that location:

#If Mac Then
Private Declare Function TA_Activate Lib "/path/to/libTurboActivate.dylib" Alias "Activate" () As Long
...

Apply that same hardcoded location to all the "Private Declare Function" statements in the Mac section of the #If block.

Modify the GetTADirectory() function

After adding the TurboActivate.bas file to your VBA app you'll need to modify the GetTADirectory() in that TurboActivate module. Change the behavior of the GetTADirectory() function to get the directory of your VBA app, and thus the directory containing the TurboActivate.dll, TurboActivate.x64.dll, and the TurboActivate.dat files.

The default behavior of the GetTADirectory() function is to find the folder relative to the current running Excel Worksheet. This may or may not be the best behavior for your VBA app (especially if you're not using Excel). Also, when you modify the GetTADirectory() function the code your write doesn't have to apply to all platforms. You can do Mac OS X specific and Windows specific directories:

#If Mac Then
    ' Get your app's TurboActivate folder (Mac OS X specific)
#Else ' Windows
    ' Get your app's TurboActivate folder (Windows specific)
#End If

At the start of your program you can tell TurboActivate where to find the TurboActivate.dat file by using this GetTADirectory() function:

TurboActivate.PDetsFromPath(GetTADirectory() & "/TurboActivate.dat")

VersionGUID

You must set the TurboActivate.VersionGUID property before you use any TurboActivate functions. We recommend you set the VersionGUID property when your application first loads. You only need to set it once:

TurboActivate.VersionGUID = "Version GUID you copied earlier"

IsActivated(), IsGenuine(), IsGenuineEx()

There are 3 separate TurboActivate functions for checking whether a customer is activated or not:

For most cases we recommend using IsGenuineEx(). For example:

Dim isActivated As Boolean
Dim gr As IsGenuineResult

' Check if we're activated, and every 90 days verify it with
' the activation servers. In this example we won't show an
' error if the activation was done offline
' (see the 3rd parameter of the IsGenuineEx() function)
gr = TurboActivate.IsGenuineEx(90, 14, True)

isActivated = gr = IsGenuineResult.Genuine Or _
              gr = IsGenuineResult.GenuineFeaturesChanged Or _
              gr = IsGenuineResult.InternetError

If isActivated Then
    ' your app is activated and genuine

    If gr = InternetError Then
        'TODO: give the user the option to retry the genuine
        '      checking immediately. For example a dialog box.
        '      In the dialog call IsGenuine() to retry immediately.
    End If
Else
    ' TODO: Not genuine or not activated. Either way you should either
    ' restrict the user from using your app or give the user a trial
    ' of your app.
End If

UseTrial(), TrialDaysRemaining()

The UseTrial() function starts and/or revalidates the trial. The TrialDaysRemaining() function returns the number of days remaining in the trial. When TrialDaysRemaining() returns 0 you should disable your apps features and require them to activate. See the example project.

Note: Always call UseTrial() before calling TrialDaysRemaining().

' ...

If isActivated Then
    ' your app is activated and genuine, see above
Else
    ' not genuine / not activated

    TurboActivate.UseTrial()

    If (TurboActivate.TrialDaysRemaining = 0) Then
        'TODO: disable the features of your app
    Else
        ' trial days remaining
    End If
End If

Learn more about using trials & trial extensions to win over prospective customers.

TurboActivate wizardActivating your product

We recommend you use the TurboActivate.exe for entering product keys and activating your product. In the example project we show how to launch TurboActivate.exe and then check if the user is activated after it closes.

If you want to build your own interface then just use the CheckAndSavePKey() and Activate() functions.