How can I programmatically remove a (known) password from an Excel VBA project?
To be clear: I want to remove the password from the VBA Project, not the workbook or any worksheets.
How can I programmatically remove a (known) password from an Excel VBA project?
To be clear: I want to remove the password from the VBA Project, not the workbook or any worksheets.
Another way to remove VBA project password is;
UPDATE: For Excel 2010 (Works for MS Office Pro Plus 2010 [14.0.6023.1000 64bit]),
If workbook is protected:
xl
workbook.xml
and select Edit<workbookProtection workbookPassword="XXXX" lockStructure="1"/>
(XXXX
is your encrypted password)XXXX
part. (ie. <workbookProtection workbookPassword="" lockStructure="1"/>
)If worksheets are protected:
xl/worksheets/
folder.Sheet1.xml
, sheet2.xml
, etc and select Edit.<sheetProtection password="XXXX" sheet="1" objects="1" scenarios="1" />
<sheetProtection password="" sheet="1" objects="1" scenarios="1" />
).xlsx
file you can also unzip it, do the search/replace on the xl/vbaProject.bin
file and then re-zip.
May 20, 2013 at 17:01
I found another way to solve this one to avoid password of VBA Project,with out loosing excel password.
use Hex-editor XVI32 for the process
if the file type is XLSM files:
xls
file and Excel 2016. Using Mikes help worked when I changed the file from xls
to xlsm
. I did not need 7-zip
to get a bin file.
This has a simple method using SendKeys to unprotect the VBA project. This would get you into the project, so you'd have to continue on using SendKeys to figure out a way to remove the password protection: http://www.pcreview.co.uk/forums/thread-989191.php
And here's one that uses a more advanced, somewhat more reliable method for unprotecting. Again, it will only unlock the VB project for you. http://www.ozgrid.com/forum/showthread.php?t=13006&page=2
I haven't tried either method, but this may save you some time if it's what you need to do...
My 2 cents on Excel 2016:
xls
file with Notepad++
DPB=
and replace it with DPx=
error 40230
)I found this here that describes how to set the VBA Project Password. You should be able to modify it to unset the VBA Project Password.
This one does not use SendKeys.
Let me know if this helps! JFV
After opening xlsm file with 7 zip, extracting vbaproject.bin and in Notepad ++ replacing DpB with DPx and re-saving I got a Lot of vbaproject errors and vba project password was gone but no code/forms.
I right clicked to export and was able to re-import to a new project.