VBA Project Passwords

Written by

Mel Jenkins

Reviewed by

Steve Rynearson

Last updated on May 2, 2022

This article will explain how to password protect your VBA projects.

vba password msgbox

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.

vba password protect 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.

vba password project protect

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.

vba password msgbox

You will be required to enter a password before you can see any of the modules or forms contained in the project.

 

vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples