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
- Open DOS Command Prompt
- 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
- Locate Search Menu
- Click on Replace Command or directly hit CTRL + R form the keyboard
- Replace DPB to DPx
- Click on Replace All
- Confirm the replace action
- 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!!!