How to break Excel VBA Project Password in 10 Steps

How to break Excel VBA Project Password in 10 Steps

VBA Password

Sometimes developer locks the project using password to protect VBA code which he has written known a major security issue in VBA. In this article we take steps to break the password of a Excel document. Considering you have a “.xlsm” file (“testing.xlsm“) which has code protected in your VBA project. Note this method can be applied on “.DOTM” or “.DOCM” file too in Microsoft Word VBA Project.

Note: A backup of original file is recommended before performing below steps

Step 1: Zip your file using following method

  1. Open DOS Command Prompt
  2. Write REN Command to zip the file by adding .zip extension at the end and name will turn as “testing.xlsm.zip

REN command syntax:

C:>ren <SPACE> <current file path with file extension> <SPACE> <New file path with extension>

Step 2: Browse zipped file “testing.xlsm.zip” as shown below using WinZip utility:

Step 3: Locate “vbaProject.bin” file under xl directory as shown below:

Step 4: Extract “vbaProject.bin” file to a separate location to edit as shown below:

I have created a separate folder “Bin” where I am extracting the “vbaProejct.bin” file for further manipulation as shown below:

Step 5: Open “vbaProject.bin” file for editing. Since the file is in HEX format hence you would require a HEX Editor. I would recommend open source Hex editor can be downloaded from here.

Step 6: Perform find replace using HEX Editor as

  1. Locate Search Menu
  2. Click on Replace Command or directly hit CTRL + R form the keyboard
  3. Replace DPB to DPx
  4. Click on Replace All
  5. Confirm the replace action
  6. Save the file and close HEX Editor

Step 6: Go back to WinZip explorer from where we extracted the “vbaProject.bin” file in Step 4 and delete the same. Now locate your changed file (kept in Bin folder) and drag it into WinZip explorer where you deleted the “vbaProject.bin” file.

Step 7: Close WinZip explorer and go back to command prompt where we need to rename our “testing.xlsm.zip” file to original “testing.xlsm” as shown below:

Step 8: Open “testing.xlsm” file in Excel and it will prompt for DPx change saying Continue, No. Click Continue as it is an impact of the change that we made through Step 5 and Step 6 as shown below:

Step 9: Now to verify VBA project press ALT + F11 or click on Developer Ribbon tab >> Macros to view Visual Basic Editor window as shown below:

Step 10: Export all modules or forms in a directory and create a new file then re-import. It works!!!

Leave a Reply

Your email address will not be published. Required fields are marked *