Remove Excel VBA password

Problem

I usually don't deal with VBA (thank goodness) - but I have been asked on several occasions to remove a VBA password from an excel workbook.  In the instances that I did (remove the password) it was not for nefarious purposes, but because someone had either forgotten the password or had a file they were now responsible for and the previous user had (who set the password) had left the company.

Plus, I quite enjoyed removing passwords with this approach since it reminded me of my youth and hex-editing files (anyone remember hex-editing SimCity 2000 saves to give you lots of money??).

Solution

You'll need a hex-editor for this.  Something like trusty ol' XVI32.

Make sure you have a backup of the file in case something goes wrong.

.xls (or .xla)

These are older files but they are still around.  Open the file in your hex-editor and find for text string "DPB":

 

 

 

 

 

 

 

 

 

 

Now basically just click on the B in DPB and replace it with an "x", like this:

 

 

 

 

Save and exit your hex-editor.

 

Your not done yet...

Open the file in excel - you may receive a couple of error notifications, just click through them.

Open the Visual Basic window (usually ALT+F11 if I remember correctly) and open the VBAProject properties (Tools menu).

Click on the Protection tab and change (do not remove at this stage) the password to something short and easy to remember (we'll be removing in next step).

 

 

 

 

 

 

 

 

Save the workbook and then close and reopen.

Open again the Visual Basic window and enter the password you just put in.  Redo the previous step but this time you can remove (delete) the password.

Save the workbook and you have now removed the password.

.xlsm

For xlsm files you need to do an extra step at the start.  Basically xlsm is a zipped format, so rename the extension to .zip and do the following:

  1. open and open "xl" folder
  2. extract "vbaProject.bin"
  3. do hexedit method (see left)
  4. save and reinsert into zip
  5. rename back to xlsm.
  6. repeat steps previously outlined by changing and then removing the password.

 

NOT: Bu yöntemi şifresini unuttuğunuz excel dosyaları üzerinde uygulayın lütfen. Size ait olmayan excel dosyaların şifreleri kırmak için kullanmayın. Aksi halde bu işin Allah indinde vebali olacaktır ki bu vebalden kaçınmak gerek. Mesuliyet size aittir. 

NOTE: Please apply this method on excel files you have forgotten to decrypt. Do not use to crack passwords of excel files that do not belong to you.
Otherwise, this work will be plague in the land of Allah, which should be avoided. You are responsible.