VBA Code Protection > Writing and compiling secure VBA code |
The goal is to protect sensitive parts of your VBA code by compiling them into bytecode with XLS Padlock. We recommend you to mix existing VBA code and compiled bytecode.
In Excel, click “VBA Compiler and Protection” to open the XLS Padlock VBA Editor and Compiler:
The XLS Padlock VBA editor is displayed:
In the text area with syntax highlighting, enter the VBA code that you want to compile. You can group it into subs and functions. It is possible to open the Visual Basic Editor by clicking “Show Visual Basic Editor” and to copy/paste your code.
By default, all subs and functions have one parameter named Param1. However, it’s possible to use more parameters.
When you are done, click “Compile Code”. The VBA code is instantly compiled into bytecode that XLS Padlock will store until you compile your application EXE file.
If an error is detected, it is displayed, and the responsible code is underlined in red.
Click “Save and close” to close the editor.
Invoking compiled VBA code at runtime