What to Do When You Don’t Remember Word Excel VBA Project Password

You have spent some time working on a VBA project quite while ago. You locked it down with a password when you delivered it to your client. Now you are tasked to improve that project with new features and bug fixes. The only problem is that the password you set in the project was just so strong that there is no way for you to remember it anymore.

What to do?

While there is no way to retrieve it from the project file, there is a way to crack it so you can reset it with a new password.

Tool to use

We will be using a Hex Editor tool to replace a binary bit in the project file that will let Office application to open the project with a blank password in it. Most of the Hex Editor tool out there can do the job. I am using one called HxD which is free and portable.

Old office format prior to Office 2007

If the VBA project is saved in an old Office format like .dot or .xlt, you can open the file in Hex Editor, search for the text string “DPB=“.

And replace it with DPx=, save and close the tool.

Now, let’s open the file again. You will get a warning message saying that it contains an invalid DPx value. Click Yes to continue on opening the file.

The file opens up with a blank password set in the VBA project. You can reset it with a new password in Project Properties to lock it down again when you are done the work.

New Office format since Office 2007

The above method won’t work if the VBA project was saved in a new Office format like .dotm or .xlsm, which happens to be in an archive format that can be opened directly in tools like 7Zip or Windows Explorer if renaming it to .zip.

Open the file in 7Zip, extract a file called vbaProject.bin from word folder onto your Desktop for easy access.

Then open the vbaProject.bin file in Hex Editor, search and replace the text string DPB with string DPx. Save it back to the archive.

Now, open the file again, click Yes button on the warning message dialog. The VBA project will be available with no password in place.

That’s about it. The method works on both Word and Excel templates regardless of which version of Office you are using.

Kent Chen

Microsoft MVP, IT Professional, Developer, Geek, and the co-founder of Next of Windows.

Last updated: 12/15/2016

Posted in: Office
Discover more: , , , ,