How to protect VBA Project and code with VBA password
VBA password protection
To prevent your source code from prying eyes you can use password protection of the VBA Editor (VBE) and VBA Project in your MS Excel workbook. It is a standard technique to protect your macros in all MS Office applications which is available by default.
You can protect VBA Project and VBE in Excel by just following these steps:
1. Open VBA Editor in Excel by pressing Alt+F11 or selecting “Visual Basic” item in the Developer dropdown menu.
2. In the VBA Editor menu select the “Tools” menu item and click on the “VBAProject properties”.
3. In the opened “VBAProject – Project Properties” window, select the “Protection” tab.
4. Check on the “Lock project for viewing.
5. Enter your password and confirm the password.
6. Click OK and save your workbook.
Once you have finished protecting your macros using those steps, your VBA Project workbook will now prompt you for a password each time you request access.
After entering the correct password, the VBA editor will be available for editing your source code.
VBA Password cracking
Important Notice: The VBE password protection is not strong protection. It will not stop malefactors from viewing or copying of your VBA code.
There are a lot of tools, many of which happen to be free or easily available as commercial tools on the market, that can be used to remove or recover the VBE password in the workbook.
You need to consider the VBA editor password protection for your projects only in the case of protection against the accidental changes of your code by customers or consumers.
If you want to be sure that nobody can see or copy your source code, this approach doesn’t meet your needs.
VBA password alternatives
Many methods exist to protect Excel macros from being viewed and copied. Many of these are available for free or as commercial products on the market. However, not all of them provide real protection of VBA code.
VBA obfuscation – is the technique which makes source code unreadable for humans. However, the structure and logic of these algorithms has not changed. This means that the VBA project still contains these algorithms. This approach doesn’t protect your algorithms from being traced or copied.
Unviewable VBA approach – is a technique when VBA code is protected by different low-level workbook and VBA project modifications, which do not allow for your code to be viewable in Excel VBA Editor. This approach doesn’t protect your VBA code from being viewed or copied. This is because you can easily reach the source code through different methods and tools outside of Excel.
Translation of Visual Basic code to another compiling language – This approach assumes translation of the VBA language code into another, compiled language like C#, C, or C++. This approach is more effective for source code protection but is much more labor intensive, time consuming, and significantly more error prone.
Please read more information about and familiarize yourself with the strengths and weaknesses of the different possible approaches of VBA protection.
The VbaCompiler for Excel is the best alternative for standard VBA security
The DoneEx VbaCompiler for Excel is the best VBA code protection alternative for VBA password protection because of the following:
- VbaCompiler converts your VBA code into C-language code and compiles it into a Windows DLL in a fully automated manner without any of your participation in the process.
- VbaCompiler doesn’t change your original workbook because it works with copy of the workbook.
- It converts all of the VBA code in the compiled workbook into a Windows DLL file. This removes it from the VBA project and makes it unavailable to anybody.
- Consequently, there is no way to restore your VBA code from compiled Windows DLL.
- You do not need to know any other programming language except VBA in order to use the VbaCompiler for Excel.
- It supports all 32-bit and 64-bit Windows Excel versions since Excel 2007 and higher for, both, compilation and run-time. This includes Excel in Office 365.
- In fact, your VBA code may work much faster after compilation.
- Above all, compiled code works with the same logic and doing the same work as your original VBA code.
- You can also distribute your workbook as a single Windows Installation package, which you can create by using our free DoneEx Installer Maker.
- With VbaCompiler for Excel you can license your workbook or Excel add-in. As a result, this means that you can define which computers can open your compiled workbook.