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.
Removing the mot de passe from a VBA project
Re: Removing the mot de passe from a VBA project
Another way to remove VBA project password is;
- Open xls file with a hex editor.
(ie. Hex Edit [http://www.hexedit.com/](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 ` ` (`XXXX` is your encrypted password)
- Remove `XXXX` part. (ie. ` `)
- 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 ` `
- Remove the encrypted password (ie. ` `)
- 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.
- Open xls file with a hex editor.
(ie. Hex Edit [http://www.hexedit.com/](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 `
- Remove `XXXX` part. (ie. `
- 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 `
- Remove the encrypted password (ie. `
- 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.