Unlocking VBA Scripts

Not related to a specific OLAP tool. (Includes forum policies and rules).
Post Reply
User avatar
jim wood
Site Admin
Posts: 3951
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Unlocking VBA Scripts

Post 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.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Unlocking VBA Scripts

Post 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.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
lotsaram
MVP
Posts: 3651
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Unlocking VBA Scripts

Post 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?
Wim Gielis
MVP
Posts: 3103
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Unlocking VBA Scripts

Post 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
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
risk
Posts: 6
Joined: Thu Feb 21, 2013 2:56 pm
OLAP Product: TM1
Version: 9.5.2 FP3
Excel Version: 2010 and 2013 32bit

Re: Unlocking VBA Scripts

Post 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)
Post Reply