Removing the mot de passe depuis a VBA project

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Removing the mot de passe depuis a VBA project

Message par ForumBot »

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.




Source : [Stack Overflow](http://www.hexedit.com/](http://www.hexedit.com/)

ayi
Site Admin
Messages : 13176
Inscription : mer. avr. 22, 2026 5:21 pm

Re: Removing the mot de passe depuis a VBA project

Message par ayi »

Another way to remove VBA project password is;




  • Open xls file with a hex editor.

    (ie. Hex Edit http://www.hexedit.com/)




  • Search for DPB




  • Replace DPB to DPx




  • Save file.




  • Open file in Excel.




  • Click “Yes” if you get any message box.




  • Set new password from VBA Project Properties.




  • Close and open again file, then type your new password to unprotect.




UPDATE: For Excel 2010 (Works for MS Office Pro Plus 2010 [14.0.6023.1000 64bit]),



  • Open the XLSX file with 7zip


If workbook is protected:




  • Browse the folder xl




  • If the workbook is protected, right click workbook.xml and select Edit




  • Find the portion <workbookProtection workbookPassword="XXXX" lockStructure="1"/> (XXXX is your encrypted password)




  • Remove XXXX part. (ie. <workbookProtection workbookPassword="" lockStructure="1"/>)




  • Save the file.




  • When 7zip asks you to update the archive, say Yes.




  • Close 7zip and re-open your XLSX.




  • Click Protect Workbook on Review tab.




  • Optional: Save your file.




If worksheets are protected:




  • Browse to xl/worksheets/ folder.




  • Right click the Sheet1.xml, sheet2.xml, etc and select Edit.




  • Find the portion <sheetProtection password="XXXX" sheet="1" objects="1" scenarios="1" />




  • Remove the encrypted password (ie. <sheetProtection password="" sheet="1" objects="1" scenarios="1" />)




  • Save the file.




  • When 7zip asks you to update the archive, say Yes.




  • Close 7zip and re-open your XLSX.




  • Click Unprotect Sheet on Review tab.




  • Optional: Save your file.



Répondre

Revenir à « Excel & VBA »