Skip to content

About the Built-in VBA Compiler

XLS Padlock features an integrated VBA compiler that transforms your Basic scripts into secure bytecode, making them inaccessible to end-users. Compiling parts of your VBA macros removes the original source code, making it impossible to copy.

For instance, consider this original code:

Original VBA calculate sub source code shown in the Excel VBA editor

Once protected, the original calculate() sub is replaced by a call to an internal XLS Padlock function that executes the compiled bytecode:

Protected sub replaced by a call to an internal XLS Padlock function running the compiled bytecode

The original code is moved into the XLS Padlock VBA Editor and compiled from there:

Original code moved into the XLS Padlock VBA editor for compilation

Note that some modifications may be necessary, as the compiler requires explicit use of the Application object to access Excel objects.

The compiler is not a simple obfuscator; it completely transforms your VBA code into binary and stores it securely within the application. When combined with password-protecting your VBA project, this renders password-cracking tools useless, as they cannot access the original XLS file.

👉 See Also: Learn how to write and compile secure VBA code