This article will explain how to password protect your VBA projects.
When you create a custom VBA add-in or series of macros for a user, you might like to protect your intellectual copyright, or that of our company’s, by password protecting your code so that it is not easy to copy.
Note: VBA Protection is very easy to get around. You should not rely on this security.
Amending VBA Project Properties
To password protect a VBA Project, we need to amend the VBA Project Properties.
In the VBE Editor, right-click on your VBA Project in the Project Explorer, and then click VBA Project Properties.
First, (1) click on the Protection tab and then, 2) make sure that “Lock project for viewing” is checked. Next (3) in the “Password to view project properties“, type in the password and then confirm the password. Finally (4), click OK.
Note: when creating a password, the more complicated the password, the harder it will be to crack!
Save and Close your file, and then re-open the file and press ALT+F11 to open the VBE Window once again.
Double-click on your VBA Project in order to view the modules and/or forms contained in the Project.
You will be required to enter a password before you can see any of the modules or forms contained in the project.