VBA
approach which doesn't require HEX editing. It will work for any files (*.xls, *.xlsm, *.xlam ..). code credited to Siwtom (nick name), a Vietnamese developer
.xls
format spreadsheet (the default for Excel up to 2003). For Excel 2007 onwards, the default is .xlsx
, which is a fairly secure format, and this method will not work.DPB=..
partDPB=..
string to DPx=..
.xlsm
or .dotm
file type you need to do it a slightly different way..xlsm
file to .zip
.vbaProject.bin
file and open it in a Hex Editor (I use HxD, its completely free and lightweight.)DPB
and replace with DPx
and save the file.vbaProject.bin
file with this new on in the zipped file..xlsm
..xlsm
file.CMG='XXXX'rnDPB='XXXXX'rnGC='XXXXXX'
in your 'known password' file is shorter than the existing block in the 'unknown password' file, pad your hex strings with trailing zeros to reach the correct length.CMG='xxxxxx'rnDPB='xxxxxxxx'rnGC='xxxxxxxxxx'
CMG='XXXX00'rnDPB='XXXXX000'rnGC='XXXXXX0000'
to preserve file length.2007, 2010, 2013 or 2016
versions with extensions .ACCDB .XLSM .XLTM .DOCM .DOTM .POTM .PPSM
) can be easily removed..ZIP
, unzipping the file, and using any basic Hex Editor (like XVI32) to 'break' the existing password, which 'confuses' Office so it prompts for a new password next time the file is opened..ZIP
extension.ZIP
and go to the XL
folder.vbaProject.bin
and open it with a Hex EditorDPB
to DPX
..bin
file back into the zip, return it to it's normal extension and open the file like normal.VBA Project Properties
.Protection
tab, Set a new password.OK
, Close the file, Re-open it, hit ALT+F11.50 4B
-- used in formats like .xlsm
), then unzip the file and look for the subfile xl/vbaProject.bin
. This is a CFB file just like the .xls
files. Follow the instructions for the XLS format (applied to the subfile) and then just zip the contents.DPB=
block and replacing the text Java
you may try VBAMacroExtractor
. After extracting VBA scripts from .xlsm
I've found there password in plaintext.