Protect Excel VBA code and lock VBA project
By default, Microsoft Excel offers VBA project password protection as a way to protect VBA code. This method of VBA code protection is weak and can be easily cracked. The DoneEx XCell Compiler provides a much better and much stronger solution to protect your VBA code from being stolen.
You can apply strong VBA code protection to the Excel workbook macros by following these easy steps:
1. Open the XCell Compiler compilation form by clicking on the “Compile” item in the DoneEx Excel ribbon menu.
2. Enable the Protect VBA code option.
This should cause the “VBA Protection Options” menu to pop up.
You can also just enable the “Unviewable VBA code” option to select both the “Obfuscation” and the “Literal Removing” options at the same time.
Once compilation is successful, you should see this window:
Now your VBA macros are strongly protected, and your Excel formulas are protected with the best possible protection thanks to DoneEx XCell Compiler!
How VBA code protection works
To provide the strongest and most reliable VBA code copy protection, DoneEx XCell Compiler uses 2 different approaches which are combined into one solution when you select all of the options of “VBA Protection”.
Unviewable VBA project and VBA source code.
The “Unviewable VBA project” option locks access to the VBA macros, makes the VBA project unviewable, and disables VBA debug mode.
After applying this option, the VBA project and macros will be unviewable and unavailable in the protected workbook.
Any attempt to trace your macro code will fail because VBA debug mode will be disabled.
VBA source code modification.
Two options—the “Code obfuscation” option and the “Literals removing” option—modify the Visual Basic code in a way that keeps the code functional but makes it scrambled and incomprehensible.
After applying the “Literals removing” option, the modified Visual Basic macros become tied to the XCell Compiler run-time library and will only be functional in the protected workbook.
After applying all 3 options simultaneously you will get the strongest VBA source code protection available, which has the following advantages:
- The VBA code is unviewable and inaccessible from the Excel VBA project.
- The VBA debug mode is disabled, so it is impossible to trace the Visual Basic code.
- All comments and empty lines are removed from the macros.
- The macors with removed literals will not work outside of the protected spreadsheet.
- The VBA soruce code is modified in such a way so that it is incomprehensible and unrecoverable.
Below you can see an example of Visual Basic code transformation after applying both of the code modification options.
The original VBA source code before applying ‘Protect VBA code’ option in XCell Compiler:
In case if you consider the VBA protection approach based on obfuscation is not secure enough then you need to take a look at DoneEx VbaCompiler for Excel which provides the absolute, bulletproof VBA protection of your code as in workbook as in Excel Add-Ins. The VBA Compiler convert the Excel VBA code into native Windows DLL and provides additional options as VBA code copy protection with registration/activation key.