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.

    THANKS!

  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.

    thanks.

  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

    @Ajay
    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…..

    Regards
    RS

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