Excel VBA copy protection with registration/activation key
Everyone who wants to monetize their Excel VBA program (Excel workbook or Excel add-in) is faced with the problem of protection of their intellectual property and potential piracy. Excel VBA code has very weak VBA code copy protection in its original state, and VBA Project password is just as bad, if not worse. Such protection cannot stop uncontrolled distribution of your program.
Here is a demonstration of how bad the original Excel VBA protection is:
The DoneEx VbaCompiler for Excel offers an easy and hassle-free VBA code copy protection mechanism with a unique approach to VBA code protection. This is the strongest approach as it involves VBA code compilation into DLL along with additional copy protection through the use of a registration/activation key.
After VBA to DLL compilation nobody can copy, trace or observe your VBA code or algorithms.
Copy protection term doesn’t mean that nobody will not be able to copy your workbook or add-in physically from one computer to another. It means that the ability of any copy working properly depends on your decision to allow that copy to work on that specific computer.
The first and most important requirement for good VBA copy protection is the complete inaccessibility of the VBA code for anyone. This requirement is guaranteed by the compilation of the VBA code into the binary DLL file format. The second requirement is ability of the author of the VBA program to control the distribution of compiled product – this is provided by VbaCompiler registration key mechanism.
When protected Excel VBA code starts, the VbaCompiler run-time will check the authorization records in the registration key you have provided to your customer. If this authorization is valid, only then the compiled VBA code starts working.
How the VBA Copy Protection Works – Step By Step
- Compile VBA code with VbaCompiler for Excel with the “Copy protection with registration key” and the “Hardware locking” options enabled.
- Supply the compiled workbook or add-in to your customer.
- Customer runs the workbook or activates add-in on his computer and sees the warning that registration key is not found. This message contains information about the customer’s computer ID and a “Copy Computer ID” button.
- Customer copies their computer ID by clicking on the “Copy Computer ID” button and pastes it into an email text — or into some other messaging system that is able to contact you — and transfers the computer ID to you.
- When you receive the computer ID that pertains to the customer’s computer, you generate the registration key with the usage of this computer ID in the respective field of the “Registration Key Tool”.
- Send the registration key file to the customer.
- Customer copies the registration key file into the folder where the compiled workbook or add-in is located. Now that copy of your product can start on that customer’s computer only.
Registration Key Tool
The Registration Key tool is the important part of the VBA copy protection solution.
Registration Key tool allows you to create a registration/activation key for the Excel workbook or add-in compiled with the “Copy Protection with registration key” option.
The VBA compiler main menu contains the “RegKey Tool” menu item. If you click this item, you see the “Registration Key Tool” window which contains all of the options that are related to activation key generation.
Path to compiled DLL – in this field you need to the enter full path name (path and file name) of the DLL file compiled with the “Copy protection with registration key” option. If you enter the name of a DLL which was compiled without this option, then you will get a message that states: “The DLL file was not compiled with license option checked on”. You may select the DLL file in the file browse window by clicking […] button on the right side of the edit field.
Application name – this field is not editable. This field displays how your application name will be shown after you entered the correct path to compiled DLL. The application name value will be taken from the DLL file.
Customer name – in this field you need to enter the name of the customer and/or the customer’s company name.
Customer e-mail – in this field you need to enter your customer’s e-mail address.
Customer computer ID – this field is only enabled if you compiled the Excel VBA code with the “Hardware locking” option enabled. You need to get the computer ID value from the customer’s computer. It will be shown in the message box when customer runs the protected workbook or add-in without a registration key.
Here is an example of how this message may appear to the customer:
Your customer needs to click on the “Copy Computer ID” button and it will copy the computer ID into their clipboard. They then need to paste that information into an e-mail — or another communication system— to transfer the computer ID to you.
Limit application usage period – This check box enables the “date from” and the “date to” pickup fields. These fields define the beginning and the end of the date period when your application will be able to run on customer’s computer.
Create RegKey button – This button starts the creation of the registration/activation key file for the DLL selected in the “Path to the compiled DLL” field. The newly generated registration key will be located in the same folder as the compiled DLL. The registration/activation key file is created with the name of compiled workbook or add-in but with a “.dat” file extension instead.
View RegKey button – This button allows you to load information from an existing registration key file into the form. You can use this button to read information from a registration key file you have already created.
Example of Registration Key Tool Usage
In this case we will consider the ApproxPi.xls compilation example with the copy protection option, the “Hardware locking” option, and the usage of Registration Key tool in order to create a RegKey for the protected workbook.
1. Compile your VBA code with the “Copy protection with registration key” option and the “Hardware locking” option on:
After a successful compilation you will see the following files in the output folder:
2. Send the compiled “ApproxPi.xls” file and the compiled “ApproxPi_xls_32.dll” file to your customer.
When they will try to open the workbook, they will get the following message:
Your customer needs to copy their computer ID using the “Copy Computer ID” button and transfer that computer ID to you by e-mail or another messaging system.
3. Once you acquire the customer’s computer ID, open the Registration Key tool by clicking the “RegKey Tool” button in the VBA compiler main menu. Once the Registration Key tool form is open, fill out the fields of the form with the following values:
– Click on […] button and select the “ApproxPi_xls_32.dll” in the “VbaCompiledFiles” folder
– Enter the customer’s name, the customer’s email, and the computer ID that your customer has given to you as in the following example:
4. You can now click the “Create RegKey” button in order to generate a registration/activation key.
Once a key have been successfully generated, you will get the following message:
and you should be able to find generated registration key that has been created in the “VbaCompiledFiles” folder
5. You send the registration key file to your customer (in this case it would be the “ApproxPi.rkey” registration key file). Once your customer receives the registration key file, they should put it into the same folder as where their ApproxPi.xls file is located (This is very important as the compiled workbook will not start if the generated RegKey is not in the same folder). When the RegKey is in the correct location the compiled workbook will start as normal.
When you have created the registration key for one customer, we recommend that you move this RegKey file into a different folder, one with the name of your customer’s e-mail, for example. We recommend this because when you will generate a new RegKey for another customer the current “ApproxPi.rkey” will be overwritten by the newly generated file.