Page 1 of 1

Unlocking VBA Scripts

Posted: Mon Jul 20, 2009 1:37 pm
by jim wood
Guys,

The company I work employed some consulants a couple of years ago and they built some good stuff in excel. The consultancy no longer exists and we want to make changes to the underlying VBA. The problem we have is that the VBA is password protected and they never left us with the passwords. Does anybody know if there is a way round this?

We are usig Excel 2003 SP2

Many thanks,

Jim.

Re: Unlocking VBA Scripts

Posted: Mon Jul 20, 2009 9:05 pm
by Alan Kirk
jim wood wrote: The company I work employed some consulants a couple of years ago and they built some good stuff in excel. The consultancy no longer exists and we want to make changes to the underlying VBA. The problem we have is that the VBA is password protected and they never left us with the passwords. Does anybody know if there is a way round this?
No easy way around it I'm afraid, Jim. (As in, unlike breaking worksheet or workbook protection, a few lines of code won't do it.)

I suggest that you take a look at this page on JE McGimpsey's site:
http://www.mcgimpsey.com/excel/fileandvbapwords.html

and this one on Chip Pearson's:
http://cpearson.com/excel/password.htm

Now I've never used any of the products / services either; I downloaded a demo of one a few years back which promised to return the first two characters of the password, and it did, without fail. (Can't recall the name of it now.) So some of these apps will clearly work, though you have to pay a few bucks for them.

Re: Unlocking VBA Scripts

Posted: Mon Jul 20, 2009 10:26 pm
by lotsaram
Workbook and worksheet passwords are trivial to crack with VBA once the workbook is already open, however the workbook open and VBA module passwords have much stronger encryption and can only be cracked with brute force. There is software out there to break the passwords which Alan has provided links to but depending on the strength of the password and the algorithm the program uses it might still take hours and hours to break the password.

The company might not exist any more but why not call one of the consultants and ask for the password?

Re: Unlocking VBA Scripts

Posted: Thu Jul 23, 2009 7:48 am
by Wim Gielis
Hi

I have a program to convert the VBA password into another password (that you know then). It cannot (or won't) tell you the previous password. If interested, leave me a PM Jim.

Wim

Re: Unlocking VBA Scripts

Posted: Tue Mar 11, 2014 5:46 pm
by risk
For xls and xla formats
1. Open the file with a hex editor. I use freeware HxD because it was included in the LiberKey Suite.
2. Do a string search for "DPB" and replace that with "DPx".
3. Save the file with a new name so you do not overwrite the original.
4. Open the xls/xla with Excel. On file opened, you will get many errors - just click "OK" through them all.
5. Go the Visual Basic Editor (Alt+F11).
6. Access the VBAProject Properties of the subject file by either right clicking the file or by using the Tools menu in the toolbar.
7. On the Protection tab make a new password that you will remember.
8. Save the file and open it again
9. Go the Visual Basic Editor (Alt+F11) and remove the password using the password you created in step 7.
10. Save the file
The VBA is now unprotected

For .xlsm formats
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 one 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)