February 22nd, 2010

Access to protected VBA projects in Excel 2003

Do you know these situations when you made some kind of a form in Excel, password protected the workbook, sheets and/or even VBA access…and months later people ask for password in order to modify it? This is were trouble starts – how should I know what password I used months ago and, of course, I did not share it ;-).

Since I had this situation several times at work, herewith – more as a reference for myself – a short walkthrough how to regain access to your VBA project .

Of course, this is only supposed to help on your own projects and not be used to access other people’s work! And same story as always: Make a backup of your file before you start. I found this originally at Schmitti’s Page.

As a prerequisite you’ll need some kind of Hex Editor in order edit the file:

  1. Open file with Hex Editor.
  2. Search for the bytes 44 50 42, or for the chars DPB. Be sure that strings “GC=” and “[Host Extender Info] exist after these chars!
  3. Change the chars DPB to DBx.
  4. Save the file.
  5. Open the file with Excel.
  6. Choose “Yes” in error message asking for continuing loading.
  7. Confirm “Ok” in unexpected error message which follows.
  8. Open the preferences of the VBA project (Alt + F11 -> Tools -> VBAProject Properties) and enter a new password. This step is implicitly required and finalize by confirming with “Ok”.
  9. Finally repeat Step 8, delete your new password and save file.

Leave a Reply