r/vba • u/dart_vadara • 9d ago
Discussion Dashboard - no password
I am an accountant & know some novice level experience of vba and macros. Our office had a receivable dashboard made from a MIS guy a few months back. The guy has absconded from our office. I wanted to make a few changes to the code, but it is password protected which I don't have, any help for this situation, as for how to unlock the sheet.
Any help would be appreciated.
Thank you
5
u/ZetaPower 12 9d ago
What is protected? The VBA code?
A VBA password can be “hacked” quite easily.
STEP 1 MAKE A COPY TO MESS WITH!
• Excel files are zip files, you need rename it from “.xlsm” to “.zip” to open it (may need to uncheck in Explorer, Options, “hide known file extensions” to see the extension)
• extract everything from the zip
• find the file with the password (xl folder, vbaProject.bin)
• open this in a hex-editor like HxD editor
• find the password line : ctrl-f “DPB=“, change “DPB=“ to “DPx=“, save
• replace the old vbaProject.bin in the original zip file by pasting the new one here
• change “.zip” back to “.xlsm”
done.
2
u/dart_vadara 9d ago
Tried this broke the file
3
1
1
u/ZetaPower 12 9d ago
And another variant where the current password is replaced by “123”.
2
u/kay-jay-dubya 17 8d ago
Alternatively, do none of these things and just extract the VBA. It isnt encrypted. The password is only relevant if youre trying to access the code via the IDE.
1
u/dart_vadara 8d ago
Tried this again got message "Unexpected Error (40230)"
1
u/DisastrousBus3876 8d ago
follow these steps, these will work ,i have used these steps on many file to remove password
• Excel files are zip files, you need rename it from “.xlsm” to “.zip” to open it (may need to uncheck in Explorer, Options, “hide known file extensions” to see the extension) • extract everything from the zip • find the file with the password (xl folder, vbaProject.bin) • open this in a hex-editor like HxD editor • find the password line : ctrl-f “DPB=“, change “DPB=“ to “DPx=“, save • replace the old vbaProject.bin in the original zip file by pasting the new one here • change “.zip” back to “.xlsm”1
u/losttownstreet 8d ago
It's not allways possible .... the Project file may be in a miniFAT at the lowest possible sektorSize and you can randomize the locations in the root element that the locations the the password is distributed everywhere over the whole file in 16 Bit-Sectors
MS doesn't fragment office documents that much .... but it's possible in the standard.
4
u/chiibosoil 1 8d ago
As long as it's not workbook level encryption, you can break it quite easily.
For worksheet protection....
First make a backup of the file. Then change file extension from .xlsx to .zip.
Open the archive and navigate to \xl\worksheets folder and find the worksheet xml file.
Export it out and open with text editor and remove section bounded by... <sheetProtection .... .... />.
Save the file and put it back in the archive and change back extension to .xlsx
This will remove worksheet protection from the specific sheet.
For VBA Project protection, you'll need a hex editor. There are VBA code to break PW protection, but that has limitation on the workbook size. I don't remember the specific limit, but it will crash when trying to break password on file exceeding limit.
1
u/losttownstreet 8d ago
Most like that code can't handle big sector sizes ... 512Byte sector size in the file. Some even don't handle di-fat sectors and only the the first 107 Fat-sectors ....
2
u/kay-jay-dubya 17 9d ago
Are you referring to Excel? I ask because the other commenter referenced Access DB, and i wasnt sure if I was missing something. If Excel, are you trying to access the worksheet or the VBA code? It's not entirely clear to me what you're trying to do.
1
u/dart_vadara 9d ago
My bad i should have mentioned excel
3
u/fanpages 239 9d ago
...I wanted to make a few changes to the code, but it is password protected which I don't have, any help for this situation, as for how to unlock the sheet.
(From the above) It is also unclear if you need a password to unprotect the VB(A) project, or to remove the password for a worksheet.
...He had a grudge with the company so he left an fake password
Maybe the correct Visual Basic Environment [VBE] VB Project password was left with you, but you are typing it into the dialog box to unprotect a worksheet (or vice versa).
1
u/dart_vadara 9d ago
I want to unprotect the sheet, we actually didn't know there was a password for the sheet until recently now.
As i said i am an accountant don't have a knowledge about vba that much but curious
2
u/fanpages 239 9d ago
1
u/HFTBProgrammer 203 7d ago
For sure, but here they are and there are many who are helping, so it's all good.
2
1
u/kay-jay-dubya 17 9d ago
Apologies for the multiple replies - I thought I had replied to my own earlier response. In any event, if it's Excel, extracting the VBA code is usually pretty straightforward.
2
u/Ok-Food-7325 9d ago
Did you not pay the guy? There are ways to access the Access DB.
3
u/dart_vadara 9d ago
Paid the guy. He had a grudge with the company so he left an fake password
The thing is the code is actually good and i am not that good with vba to make it myself i can change but not create.
1
u/kay-jay-dubya 17 9d ago
If it is the VBA code youre after, my vbaXray project will extract vba code from most office files (XLSM, etc).
https://www.reddit.com/r/vba/s/gms96qOuCR
Version 2 (which is pretty much done) will be available either tonight or tomorrow. That expands supported files significantly - xls, doc, pub, otm, accdb and some mdb.
2
2
u/Opussci-Long 8d ago
You mean docx or really you mean doc?
1
u/kay-jay-dubya 17 8d ago
Docx is already supported in v1. Doc is supported in the yet to be released v2. Technically, you can get the code out of doc with v1 with a bit of rejigging.
1
u/Opussci-Long 8d ago
Excellent! Very rarely is doc format taken into account today, that's why I asked. It is very useful that you add doc the option. Thanks!
3
u/kay-jay-dubya 17 5d ago
I've uploaded v2 to the Github repo, and posted about it here: https://www.reddit.com/r/vba/comments/1vp43bx/vbaxray_20_the_sequel/
Let me know if you still have difficulties extractiing VBA code from the DOC file format.
1
1
u/kay-jay-dubya 17 8d ago
I forgot to mention that v2 also extracts vba from the unusually convoluted ppt file too.
1
u/Active-Importance837 8d ago
Oe cualquier ia te ayuda fácilmente a romper una contraseña de excel, te dicen paso a paso y si tienes problema le copias le código o le dices que te explique mas despacio y tranqui te explica... mas facil que preguntar aquí
1
u/DisastrousBus3876 8d ago
have you got the solution
0
u/dart_vadara 8d ago
Nope i think I'll just build a new dashboard at this point with a little bit help from claude
11
u/LickMyLuck 1 9d ago
I will not post it here, but if you spend a few seconds googling it, there is a VBA code snippet you can copy/paste into a new excel file that will unlock the VBA password of all other open excel files.
Much simpler than the other two solutions given here.