2 minutes
Remove the password protection of Excel Macros
Way too often, people find themselves trying to update an existing macro in an excel file to reflect the organisation’s procedure changes.
In some of those cases, the author has protected the macro code with a password. Whatever the reason that author might have had for that, it does not prevent future use, modifications, or preserve the code’s secrecy.
As shown below, it is straightforward to remove such a password.
Here are the steps to remove the password
For older .XLS
files:
- Open file in any hex editor
- Search for the text
DPB=
- Change it to
DPx=
, save and close the file - Open the file in Excel and press Yes if the following warning pops up
- Open the VBA editor (Alt+F11) and press OK whenever warning pops up
- Right-click the VBA project name, select Properties, go to the Protection tab and delete the existing passwords as well as uncheck the Lock project for viewing checkbox and set a new password
- Click OK in the pop-up windows of Excel, and now the VBA code is accessible!
For newer .XLSM
files:
- Change the file’s extension to
.ZIP
- Open the file in any program you use for compressed files. I suggest 7-Zip
- Go into the xl directory and extract
vbaProject.bin
: - Perform steps above with
vbaProject.bin
- Replace the old
vbaProject.bin
in theZIP
file with the new hex edited version - Change the file’s extension back to
.XLSM
- Perform steps above share
You can use any hex editor; I suggest this light freeware program: HxD