Home > Excel, Geek > Removing an Excel VBA password – using a Hex editor

Removing an Excel VBA password – using a Hex editor

A VBA project password can be removed with a hex editor (I used the XVI32 Freeware editor from here).  Although I didn’t discover this method, I’m happy to post the process with screenshots to help others.  Sometimes all we need is that little snippet of code in an old VBA project we’ve archived away…

Open your chosen workbook file (.xls or .xla file) in the hex editor. It will look like the following;

The XVI32 Hex editor

Now search for the Text string “DPB” and change it to “DPx” (simply type over the value).

Search for text string "DPB"

Completed search

Change from DPB to DPx

Save the file over the top of the existing workbook and close.

Save protection settings

Now, open the workbook in Excel and click OK until the workbook is open (you may receive a couple of VBA errors on the way). Press ALT+F11 to open the Visual Basic Project window, From the Tools menu, choose the command VBAProject Properties, navigate to the Protection tab, and change the password but do not remove it (note the new password).

Save the workbook, close, and re-open.

Once open, press ALT+F11 and enter the new password.

Finally, choose Tools -> VBAProject Properties, navigate to the Protection tab, and remove the password.

Save the workbook.

  1. Ajay
    July 8th, 2013 at 16:28 | #1

    Thanks a lot it works. You can download Hex editor from : http://www.hhdsoftware.com/Downloads/free-hex-editor

  2. Add-In Macros?
    July 17th, 2013 at 04:37 | #2

    I have different type of issue: There is an Excel add-in installed which is a macro. So there is no XLS sheet per se but every sheet I open I can see this macro (xxxx.XLA). Any way I can edit this one? Thanks in advance!

  3. Gordo
    August 14th, 2013 at 00:10 | #3

    To crack a 2007/2010 Excel VBA password:
    1. Change .xlsm extension to .zip
    2. Open the zipped folder and navigate into the “xl” folder
    3. Extract the vbaProject.bin file and open it in a Hex Editor
    4. Search for “DPB” and replace with “DPx”
    5. Replace the old vbaProject file with this new on in the zip folder (and re-zip)
    6. Change the file extension back to .xlsm
    7. Open workbook and ignore all warning messages
    8. Export the code modules and then re-add them (delete the old ones)

  4. Dawn
    August 30th, 2013 at 21:57 | #4

    Gordo :
    To crack a 2007/2010 Excel VBA password:
    1. Change .xlsm extension to .zip …
    2. …
    3. …
    Steps 4 – 7…
    8. Export the code modules and then re-add them (delete the old ones)

    Gordo, the very clear instructions of your post have saved me! I inherited a client’s VBAProject with password protection, the original owner long gone. I figured I was going to try to completely rewrite all modules in the Project based on what I could see happening when the macros were run. This would have been a complete nightmare as I’d be guessing on a lot of the functionality. Thanks to the original posted article (March 2008) and your recent comment with simple instructions, I am able to export all the .bas and .cls files without fuss for fresh import to a clean Project.


  5. Bielan
    September 1st, 2013 at 21:47 | #5

    Muito bom man, consegui fazer filé no office 2010 em casa, mas no 2007 la na empresa deu problema, não sei se faltava alguma biblioteca(creio q sim), mas ele excluia o módulo do vba e ficava somente as Sheets normais sem código. módulos, classes e forms não apareciam.

  6. Steve
    September 5th, 2013 at 10:54 | #6

    a) People who say they can’t find “DPB”: File must be XLS (not XLA, not XLT). Alternate process for the newer …x formats requires unzipping first, and editing the VBAProject.bin file.
    b) Check your actually saving the changes – my HexEditor didn’t save “normally”, so it was “failing” because I wasn’t actually saving. Boy I felt dumb.
    c) Ignore the ‘unforseen error’ message: this hack tells XL to allow you to set a new password.
    When you open the file you have to SET A NEW PASSWORD – which you can then remove if you like. The file is broken until you set a new password and save – then the stupid errors go away.

  7. Dylan
    September 12th, 2013 at 04:51 | #7

    Thanks a lot Gordon, it worked!

  8. Surya
    October 16th, 2013 at 03:51 | #8

    Thanks a Ton!!!! I am short of words for helping me to recover a long forgotten xla password

  9. thiru
    October 18th, 2013 at 20:01 | #9

    DPB is not found in my excel file, what to do now??

  10. akmal
    October 18th, 2013 at 20:31 | #10

    That solved my problem. within less minute its worked great with excel 2003 and 2007. thanks man.

  11. thiru
    October 18th, 2013 at 23:11 | #11

    i went through your previouse reply on the same issue, but i am not able to find the DPB even after i sanging the file name to .XLS.

  12. Bernardo
    November 26th, 2013 at 02:55 | #12

    Hello…. I have some files (old files from 2000). Some of then are .XLA and one is .XLL. I would like to use it on Excel 2010/2013. But VBA projects disappears when I add-in those xla. That’s my first problem. The second, how I open the file .XLL e see what is written inside? Is it possible, save the XLL as XLAM?

    tks a lot people

  13. admin
    November 26th, 2013 at 08:08 | #13

    This is a brilliant solution Gordo, great work. I’ll post up a new entry with some screenshots in the near future. Good to see there are still ways around VBA project protection!

  14. December 11th, 2013 at 09:03 | #14

    I just went through the process of extracting and editing the VBA.bin file. The xlsm file will not open in excel after the change because it is corrupt. any suggestions?

  15. December 12th, 2013 at 08:26 | #15

    Hi , I am getting the same error as well. can you please check .

    error is . The excel cannot open xlsm because the file format or file extension is not valid . Verify that file has not been corrupted and that the file extension matches the format of the file.


  16. Edwin
    January 9th, 2014 at 04:16 | #16

    Just unzipping and rezipping an xlsm-file corrupts the file (even if no changes are done in the files).

    I’m using 7-zip. Ideas?

  17. Adam
    January 23rd, 2014 at 11:43 | #17

    Change to *.rar. It`s works

  18. Larry
    February 1st, 2014 at 06:27 | #18

    The same problem described above by Kelvin occurred in my case as well. Any ideas?

  19. Patrick
    February 12th, 2014 at 13:27 | #19

    Hi – another confirmation that this works – just don’t forget to save the bin file back to it’s original directory before rezipping – many thanks!!

  20. Rob
    February 26th, 2014 at 06:24 | #20

    What worked for me is after changing the VBA.bin file and placing back in the zip file, I renamed the zip file to .xls, not .xlsm, and opened it from there. Got the errors to click through, then opened the VB editor, entered a new pw, saved the file as .xlsm, opened again, and there all the code was. From there I took the pw off and saved. Now I can get in the code with no problem.

  21. Mynewlifex
    March 18th, 2014 at 05:49 | #21

    Not wroked for me still give me file corrupted, any advice, i changed the HEX editor twise still got the same problem use XLS instead of Xlsm same problem, how can overcome the corruption.

  22. Putri
    March 20th, 2014 at 15:25 | #22

    Thanks a lot, it works…

  23. Ranjit
    April 7th, 2014 at 03:37 | #23

    Hi Ajay,

    Could you please help me to break VBA code password.. or explain me the steps how to do. As when I open the file in hex editor and search for DBP string it doesn’t found any match…..


  24. PP
    April 23rd, 2014 at 21:58 | #24


    What do you mean by:
    Export the code modules and then re-add them (delete the old ones)
    How do I do that ?


  25. Abraham
    August 20th, 2014 at 02:12 | #25

    I did all the steps successfully but not receive error messages while open excel file, and the password is still there :( … I’m using Excel 2010…

    Best Regards.

  26. Anthony Gentle
    August 22nd, 2014 at 06:52 | #26

    I have a password protected xlam macro file thats password protected. Just wanted to mention to any future readers who may have gotten slightly confused, this is what I did and it worked perfectly:

    1. copied the .xlam to my desktop
    2. changed .xlam to .zip
    3. made a copy of the zip file (called “name_copy”)
    4. extracted name_copy.zip
    5. in a hex editor, edited DPB to DPx twice in the vbaProject.bin file
    6. in the original zip file (which was never extracted, replaced the vbaProject.bin file with the edited one from the copied zip folder
    7. renamed the original zip file back to .xlam
    8. opened the xlam and clicked Yes to about 15-20 messages, then went into developer > Visual Basic, and can now see all the modules!

    Basically its Gordo’s steps and idea, just broken out into slightly more detail, in case anyone else is like me and needs it all spelled out. All these steps may not be required, but when I extracted the original zip file and edited the bin then rezipped it, that didnt work, so I think never extracting the original zip, but instead making a copy of it then extracting and editing the copy, it helps prevent that issue.

    Thanks for this post everyone! certainly saved my day!

  27. Mayank
    September 16th, 2014 at 19:09 | #27

    hello there!
    I have a excel file (.xlsx) where i put in a strong password to OPEN and now forgot it.
    is there anyway you can help me to open it?

    best regards

  28. Mayank
    September 16th, 2014 at 19:11 | #28

    forgot to mention its excel 2007

  29. sohail
    November 12th, 2014 at 03:33 | #29


    MIne is a XLS file , howver i am unable to find DPB when find in . I press ctl+f for find.
    how can i send u a print screen to show this. i tried all the way i could.

  30. AJC
    November 19th, 2014 at 10:17 | #30

    I’ve found DPB and changed to DPx. Saved. Then sent to ZIP and then chaged extension to xlsm. When trying to open it gives me a message of corrupeted and then a second box saying its corrupted and cant open thee file. Help please…

  31. Cody
    January 27th, 2015 at 13:30 | #31

    This add-in seems to quickly remove the protection of VBA projects without needing to go behind-the-scenes and mess with the source code. Might be a simpler solution for those of us who are not as technical


  32. michael
    February 10th, 2015 at 17:54 | #32

    @Anthony Gentle

    I have got a password protected xlam macro file. Just wanted to mention to any future readers, I did all the mentioned steps and it worked perfectly.
    In step 5 I edited DPB to DPx only once in the vbaProject.bin file. No second DPB was found.
    While opening the xlam I clicked Yes/OK to several messages, then went into developer VB and can now see all the modules!

    best regards

  33. Venk
    March 29th, 2015 at 18:45 | #33

    Hi Mayank, I don have the same issue. Did you get any work around?

  34. Vin
    March 31st, 2015 at 22:31 | #34

    Thanks Gordo, worked perfectly!

  35. Steve94928
    April 29th, 2015 at 04:39 | #35

    This is great. Thank you a lot, it works beautifully. It saved me so much time and work.

  36. RC3
    May 7th, 2015 at 05:03 | #36

    I am using Excel 2010 to “recover” the password for an XLSM.

    This is what I had to do. It is a combination of steps from this post (Anthony Gentle) and from another website referenced below.

    1. copied the .xlsm
    2. changed .xlsm to .zip
    3. made a copy of the zip file (called “name_copy”)
    4. extracted name_copy.zip
    5. in a hex editor, edited DPB to DPx (search twice in an XLAM) in the vbaProject.bin file
    6. in the original zip file (which was never extracted, replaced the vbaProject.bin file with the edited one from the copied zip folder
    6b. I had to open the unedited zip file in winRAR and add the vbaProject.bin file into the rar/zip file at the original location.
    7. renamed the original zip file back to .xls
    8. opened the .xls and clicked Yes to the error messages that came up
    9.Then go into developer -> Visual Basic (click OK or YES on any messages that come up here):
    9b.Choose Tools->VBAProject Properties, navigate to the Protection tab, enter new password of your choce and then confirm it again (if you want new password). Otherwise simply leave the textbox blank, remove check from lock project for viewing, then SAVE and close excel and reopen it! (http://stackoverflow.com/questions/16847059/access-2007-unexpected-error-40230)

    10. After closing the worksheet and re-opneing, I still got an error when I opened the XLS file, so I saved as XLSM and now I can see the modules and code appears to work correctly still.

  37. admin
    May 7th, 2015 at 10:25 | #37

    Thanks for the detailed summary, that’s very helpful. I think it’s high time I updated the post to cater for .XLSM files.


Comment pages
1 4 5 6 16
  1. May 13th, 2013 at 11:55 | #1