A VBA project password helps protect the code inside an Excel workbook from being viewed or changed by unauthorized users. It is commonly used in Excel files such as XLSM and XLSB that contain macros and VBA code.
However, problems can occur when the VBA password is forgotten. You may be able to open the Excel file and use the workbook normally, but you cannot open the VBA project in the Visual Basic Editor.
If you have the correct password, changing it is simple. If the password has been forgotten, you need a different approach to regain access to the VBA project.
This guide explains how to remove a VBA password and set a new one.
What Is a VBA Project Password?
A VBA project password protects the VBA code stored inside an Excel workbook. When the project is locked, Excel asks for the password before allowing access to the VBA code.
For example, you may have an Excel file containing:
- VBA macros
- UserForms
- Modules
- Class modules
- Workbook event code
- Worksheet event code
The workbook itself can still open normally while the VBA project remains locked.
When Do You Need to Remove a VBA Password?
You may need to remove or change a VBA password when:
- You have forgotten the existing password.
- The original developer is no longer available.
- You need to update old VBA code.
- You need to check or repair a macro.
- You need to move VBA code to another workbook.
- You need to maintain an old XLSM or XLSB file.
- You want to replace an old VBA password with a new one.
Before making any changes, keep a backup copy of the original Excel file.
Method 1: Change the VBA Password When You Know It
If you know the current VBA password, you can change it directly from Excel.
Step 1: Open the Excel File
Open the XLSM or XLSB file containing the VBA project.
Step 2: Open the Visual Basic Editor
Press Alt + F11 on your keyboard.
This opens the Microsoft Visual Basic for Applications window.
Step 3: Open the VBA Project Properties
From the left-side Project Explorer, select your VBA project.
Go to:
Tools > VBAProject Properties
Step 4: Open the Protection Tab
In the VBAProject Properties window, select the Protection tab.
You will see the option to lock the project for viewing and the password fields.
Step 5: Enter the New Password
Enter the new password in the password field.
Enter it again in the confirmation field.
Make sure both entries are exactly the same.
Step 6: Save the Excel File
Click OK and save the Excel workbook.
Close Excel and open the file again to make sure the new password works correctly.
Method 2: Remove a VBA Password When You Have Forgotten It
The normal Excel settings do not provide a direct option to remove a VBA project password when the password is unknown.
If you select the VBA project and try to open it, Excel will continue to ask for the existing password.
In this situation, first create a backup copy of the Excel file. Do not work on the only copy of an important workbook.
For VBA projects that you own or are authorized to access, a dedicated VBA Password Remover Tool can be used to regain access to the protected project.
A typical process is:
- Close the Excel workbook.
- Open the VBA password recovery or removal software.
- Add the protected XLSM or XLSB file.
- Select the required recovery or password removal option.
- Let the software process the VBA project.
- Save the resulting Excel file.
- Open the processed file in Excel.
- Press Alt + F11 to check the VBA project.
- Set a new password after access has been restored.
The exact steps can vary depending on the software you use.
How to Set a New VBA Password After Removing the Old One
Once you can access the VBA project again, you can set a new password from the Visual Basic Editor.
Open the workbook and press Alt + F11.
Then select:
Tools > VBAProject Properties > Protection
Select Lock project for viewing and enter your new password.
Enter the password again to confirm it.
Click OK and save the workbook.
Close Excel completely and reopen the workbook. This step is important because the VBA project protection may not take effect until the file has been closed and reopened.
After reopening the file, press Alt + F11 and try to open the VBA project. Excel should ask for the new password.
Important Things to Check Before Removing a VBA Password
Before working on a protected Excel file, consider the following points.
Keep a Backup
Always make a copy of the original XLSM or XLSB file. If something goes wrong during the process, you can return to the original file.
Check the File Format
VBA code is normally stored in macro-enabled Excel formats such as:
- XLSM
- XLSB
- XLTM
A standard XLSX file does not normally contain VBA project code.
Test the Macros
After removing or changing VBA protection, open the workbook and test the macros. Make sure the workbook still performs its required functions.
Keep the New Password Safe
If the VBA project contains important business code, store the new password in a secure password manager or another approved location.
Do not save the password in plain text inside the Excel workbook.
Can You Remove a VBA Password Directly From Excel?
If you know the existing password, you can change the protection settings through the Visual Basic Editor.
If you have forgotten the password, Excel does not provide a normal password-reset option for opening the protected VBA project.
For files you own or are authorized to manage, a dedicated VBA password recovery or removal tool may be required.
Final Words
A VBA password is useful for protecting the source code inside an Excel workbook, but a forgotten password can make maintenance difficult. If you know the current password, you can change it through VBAProject Properties in the Visual Basic Editor.
If the password has been forgotten, keep a backup of the original workbook and use a suitable VBA password recovery or removal solution for files you are authorized to access.
After regaining access, set a new VBA password, save the workbook, close Excel, and reopen the file to confirm that the new protection is working properly.
Comments