- Excel Macro Remove Password Protection
- Password Breaker Macro Excel
- Break Password Macro
- Macro To Break Vba Password Change
How to unlock VBA password in excel 2003, 2007, 2010, 2013 and 2016? Are you also looking for a solution to break VBA project password from excel file? But do not know, how to perform this conversion. So, read this blog in detail to unlock password protected VBA code in Excel. Just like you can password protect workbooks and worksheets, you can password protect a macro in Excel from being viewed (and executed). Place a command button on your worksheet and add the following code lines: 1. First, create a simple macro that you want to protect. Range('A1').Value =.
Tej Pratap Shukla | Published: 2018-10-10T05:46:30+00:00 | Recovery|
VBA (Visual Basic for Application) is a component of MS Office and used by Microsoft application such as Excel, Word, etc. It is a filename extension for visual basic file and also contains the visual basic code. This file can be used to add functionality to Office suite and automate routine tasks in Microsoft Excel. But, sometimes the user may forget or lost VBA password and now users try to crack that password. Therefore, in the upcoming section, we are going to discuss all possible ways to let users understand how to break VBA password in Excel 2016 without any difficulty.
Prerequisites Before Executing Manual Approach
- Initially, you have to take a complete backup of VBA files
- XLSM files are similar to XLSX files but you must enable the macros to make .xlsm files as .xlsx.
Manual Methods to Break VBA Password in Excel 2016 2013, 2010, 2007 or 2003
Go through the following workarounds that will help to crack the VBA password manually. Let us have a look:
Swap Password with Hex Editor
- Create the new Excel file (XLS) using any kind of Hex editor
- Then, you need to set a specific password in VBA field (Alt + F11)
- After that, you can save that file and press Exit
- Next, open a file which you have lately created with the help of the hex editor
- Copy each line starting with the given below keys:
CMG=….
DPB=…
GC=…
DPB=…
GC=…
- Using Hex Editor, you can open a file in which you want to break the password and paste these copied lines from a dummy file
- Now, you will save the Excel files and, then exit to break VBA password in Excel
- Open the Excel file where you wish to see the VBA code and next, use the common password that you have already used for dummy VBA file in the previous step
Using WinZip / WinRar
- Change the file extension of .xlsm into .zip
- Through the WinZip / WinRar, start the ZIP file and then, select the .xl folder
- Now, you extract the vbaProject.bin file and, then open that file in Hex Editor
- Search and replace the DPB with DPx and save that particular file
- Under the Zip file, you can replace the previous vbaProject.bin file with this latest one
- Again, you have to change the file extension from ZIP to XLSM file
- Start the Visual Basic in MS Excel, choose Tools and VBAProject Properties. Then, select Protection Tab and now, you can add a new password and save .xlsm file
- Close and re-open the VBA file with a new password.
Using Workbook
- First of all, you can open the workbook in which all protected sheets are available
- Press Alt+F11 to verify or open the Visual Basic Editor. Next, type Insert-Module and paste the following code into the right corner of the window
- Now, close VB Editor screen and navigate to the worksheet that you wish to unprotect
- Type the Tools-Macro-Macros and then double-click on the password breaker in the given list.
Professional Way to Break / Open VBA Password in Excel 2016
If the above-described methods do not work well then, users can take help of an automated solution. Out of which, one such application is the VBA Excel file Password Recovery tool. It is specially programmed to recover lost or forgotten password of VBA files without any data loss. It also supports different MS Office files like .xls, .xla, .doc, .mdb, .dot file type. The best part of this tool is that it eliminates old password and generate a new VBA Project password. It has an easy-to-use interface even a technical knowledge is not mandatory while using this tool. Here the complete working steps of the tool are listed below:
- Download and install Excel VBA Password Remover on your system
- Then, choose MS Office VBA Project file like Excel, PowerPoint, Word, etc. Click the Browse button to choose the VBA Project file
- Now, you can select the VBA project files and press Open
- Finally, VBA Password Remover will automatically show the new password
Let’s Wrap Up
There are many people who have lost or forgotten their VBA password. Therefore, in this blog, we have mentioned some methods through which users can break VBA password in Excel 2016 2013, 2010, 2007 or 2003. In case if the manual ways do provide precise results. Thus, we have suggested a trustworthy and instant solution, i.e., VBA Excel Password Recovery software. With the help of this utility, users can restore lost password in a trouble-free manner.
Leave a Reply
Active2 months ago
I've been asked to update some Excel 2003 macros, but the VBA projects are password protected, and it seems there's a lack of documentation.. no-one knows the passwords.
Is there a way of removing or cracking the password on a VBA project?
user10791298
Jonathan SayceJonathan Sayce5,13533 gold badges3131 silver badges4545 bronze badges
22 Answers
You can try this direct
VBA
approach which doesn't require HEX editing. It will work for any files (*.xls, *.xlsm, *.xlam ..). Tested and works on:
Excel 2007
Excel 2010
Excel 2013 - 32 bit version
Excel 2016 - 32 bit version
Excel 2010
Excel 2013 - 32 bit version
Excel 2016 - 32 bit version
Looking for 64 bit version? See this answer
How it works
I will try my best to explain how it works - please excuse my English.
- The VBE will call a system function to create the password dialog box.
- If user enters the right password and click OK, this function returns 1. If user enters the wrong password or click Cancel, this function returns 0.
- After the dialog box is closed, the VBE checks the returned value of the system function
- if this value is 1, the VBE will 'think' that the password is right, hence the locked VBA project will be opened.
- The code below swaps the memory of the original function used to display the password dialog with a user defined function that will always return 1 when being called.
Using the code
Please backup your files first!
- Open the file(s) that contain your locked VBA Projects
- Create a new xlsm file and store this code in Module1
code credited to Siwtom (nick name), a Vietnamese developer
- Paste this code under the above code in Module1 and run it
- Come back to your VBA Projects and enjoy.
7,07911 gold badge1010 silver badges1717 bronze badges
Yes there is, as long as you are using a
.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.As Treb says, it's a simple comparison. One method is to simply swap out the password entry in the file using a hex editor (see Hex editors for Windows). Step by step example:
- Create a new simple excel file.
- In the VBA part, set a simple password (say - 1234).
- Save the file and exit. Then check the file size - see Stewbob's gotcha
- Open the file you just created with a hex editor.
- Copy the lines starting with the following keys:
- FIRST BACKUP the excel file you don't know the VBA password for, then open it with your hex editor, and paste the above copied lines from the dummy file.
- Save the excel file and exit.
- Now, open the excel file you need to see the VBA code in. The password for the VBA codewill simply be 1234 (as in the example I'm showing here).
If you need to work with Excel 2007 or 2010, there are some other answers below which might help, particularly these: 1, 2, 3.
EDIT Feb 2015: for another method that looks very promising, look at this new answer by Đức Thanh Nguyễn.
Community♦
Colin PickardColin Pickard39.8k1010 gold badges8686 silver badges139139 bronze badges
There is another (somewhat easier) solution, without the size problems. I used this approach today (on a 2003 XLS file, using Excel 2007) and was successful.
- Backup the xls file
- Open the file in a HEX editor and locate the
DPB=..
part - Change the
DPB=..
string toDPx=..
- Open the xls file in Excel
- Open the VBA editor (ALT + F11)
- the magic:Excel discovers an invalid key (DPx) and asks whether you want to continue loading the project (basically ignoring the protection)
- You will be able to overwrite the password, so change it to something you can remember
- Save the xls file*
- Close and reopen the document and work your VBA magic!
*NOTE: Be sure that you have changed the password to a new value, otherwise the next time you open the spreadsheet Excel will report errors (Unexpected Error), then when you access the list of VBA modules you will now see the names of the source modules but receive another error when trying to open forms/code/etc. To remedy this, go back to the VBA Project Properties and set the password to a new value. Save and re-open the Excel document and you should be good to go!
MD XF4,43455 gold badges3131 silver badges5757 bronze badges
PieterPieter1,97311 gold badge1111 silver badges55 bronze badges
I've built upon Đức Thanh Nguyễn's fantastic answer to allow this method to work with 64-bit versions of Excel. I'm running Excel 2010 64-Bit on 64-Bit Windows 7.
- Open the file(s) that contain your locked VBA Projects.
- Create a new xlsm file and store this code in Module1
- Paste this code in Module2 and run it
Intel proset wireless software remove. DISCLAIMER This worked for me and I have documented it here in the hope it will help someone out. I have not fully tested it. Please be sure to save all open files before proceeding with this option.
kaybee99kaybee99
2,97822 gold badges2626 silver badges3131 bronze badges
Colin Pickard has an excellent answer, but there is one 'watch out' with this. There are instances (I haven't figured out the cause yet) where the total length of the 'CMG=....GC=..' entry in the file is different from one excel file to the next. In some cases, this entry will be 137 bytes, and in others it will be 143 bytes. The 137 byte length is the odd one, and if this happens when you create your file with the '1234' password, just create another file, and it should jump to the 143 byte length.
If you try to paste the wrong number of bytes into the file, you will lose your VBA project when you try to open the file with Excel.
EDIT
This is not valid for Excel 2007/2010 files. The standard .xlsx file format is actually a .zip file containing numerous sub-folders with the formatting, layout, content, etc, stored as xml data. For an unprotected Excel 2007 file, you can just change the .xlsx extension to .zip, then open the zip file and look through all the xml data. It's very straightforward.
However, when you password protect an Excel 2007 file, the entire .zip (.xlsx) file is actually encrypted using RSA encryption. It is no longer possible to change the extension to .zip and browse the file contents.
StewbobStewbob15.3k88 gold badges5555 silver badges9696 bronze badges
For a
.xlsm
or .dotm
file type you need to do it a slightly different way.- Change the extension of the
.xlsm
file to.zip
. - Open the .zip file (with WinZip or WinRar etc) and go to the xl folder.
- Extract the
vbaProject.bin
file and open it in a Hex Editor (I use HxD, its completely free and lightweight.) - Search for
DPB
and replace withDPx
and save the file. - Replace the old
vbaProject.bin
file with this new on in the zipped file. - Change the file extension back to
.xlsm
. - Open workbook skip through the warning messages.
- Open up Visual Basic inside Excel.
- Go to Tools > VBAProject Properties > Protection Tab.
- Put in a new password and save the
.xlsm
file. - Close and re open and your new password will work.
11.3k2222 gold badges7272 silver badges102102 bronze badges
It's worth pointing out that if you have an Excel 2007 (xlsm) file, then you can simply save it as an Excel 2003 (xls) file and use the methods outlined in other answers.
Excel Macro Remove Password Protection
AndyAndy
Have you tried simply opening them in OpenOffice.org?
I had a similar problem some time ago and found that Excel and Calc didn't understand each other's encryption, and so allowed direct access to just about everything.
This was a while ago, so if that wasn't just a fluke on my part it also may have been patched.
greggreg
For Excel 2007 onward you need to change your file extension to .zipIn the archive there is a subfolder xl, in there you will find vbaProject.bin.Follow the step above with vbaProject.bin then save it back in the archive.Modify back your extension and voilà! (meaning follow steps above)
user3761175user3761175
With my turn, this is built upon kaybee99's excellent answer which is built upon Đức Thanh Nguyễn's fantastic answer to allow this method to work with both x86 and amd64 versions of Office.
An overview of what is changed, we avoid push/ret which is limited to 32bit addresses and replace it with mov/jmp reg.
Tested and works on
Word/Excel 2016 - 32 bit version.
Word/Excel 2016 - 64 bit version.
Word/Excel 2016 - 64 bit version.
how it works
- Open the file(s) that contain your locked VBA Projects.
- Create a new file with the same type as the above and store this code in Module1
- Paste this code in Module2 and run it
VePeVePe
In the event that your block of
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.e.g.
CMG='xxxxxx'rnDPB='xxxxxxxx'rnGC='xxxxxxxxxx'
in the unknown password file, should be set to
CMG='XXXX00'rnDPB='XXXXX000'rnGC='XXXXXX0000'
to preserve file length.I have also had this working with .XLA (97/2003 format) files in office 2007.
SpangenSpangen2,27044 gold badges1919 silver badges2828 bronze badges
VBA Project Passwords on Access, Excel, Powerpoint, or Word documents (
2007, 2010, 2013 or 2016
versions with extensions .ACCDB .XLSM .XLTM .DOCM .DOTM .POTM .PPSM
) can be easily removed.It's simply a matter of changing the filename extension to
.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.- rename the file so it has a
.ZIP
extension. - open the
ZIP
and go to theXL
folder. - extract
vbaProject.bin
and open it with a Hex Editor - 'Search & Replace' to 'replace all' changing
DPB
toDPX
. - Save changes, place the
.bin
file back into the zip, return it to it's normal extension and open the file like normal. - ALT+F11 to enter the VB Editor and right-click in the Project Explorer to choose
VBA Project Properties
. - On the
Protection
tab, Set a new password. - Click
OK
, Close the file, Re-open it, hit ALT+F11. - Enter the new password that you set.
At this point you can remove the password completely if you choose to.
Complete instructions with a step-by-step video I made 'way back when' are on YouTube here.
It's kind of shocking that this workaround has been out there for years, and Microsoft hasn't fixed the issue.
The moral of the story?
Microsoft Office VBA Project passwords are not to be relied upon for security of any sensitive information. If security is important, use third-party encryption software.
ashleedawgashleedawg13.7k44 gold badges2929 silver badges6262 bronze badges
Colin Pickard is mostly correct, but don't confuse the 'password to open' protection for the entire file with the VBA password protection, which is completely different from the former and is the same for Office 2003 and 2007 (for Office 2007, rename the file to .zip and look for the vbaProject.bin inside the zip). And that technically the correct way to edit the file is to use a OLE compound document viewer like CFX to open up the correct stream. Of course, if you are just replacing bytes, the plain old binary editor may work.
BTW, if you are wondering about the exact format of these fields, they have it documented now:
Yuhong BaoPassword Breaker Macro Excel
Yuhong Bao3,32311 gold badge1515 silver badges1717 bronze badges
If the file is a valid zip file (the first few bytes are
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.For the XLS format, you can follow some of the other methods in this post. I personally prefer searching for the
DPB=
block and replacing the text with blank spaces. This obviates CFB container size issues.
SheetJSSheetJS17.4k1111 gold badges5151 silver badges6767 bronze badges
I tried some of solutions above and none of them works for me (excel 2007 xlsm file). Then i found another solution that even retrieve password, not just crack it.
Insert this code into module, run it and give it some time. It will recover your password by brute force.
Luboš SukLuboš Suk
ElcomSoft makes Advanced Office Password Breaker and Advanced Office Password Recovery products which may apply to this case, as long as the document was created in Office 2007 or prior.
Charles DuffyCharles Duffy194k2929 gold badges223223 silver badges281281 bronze badges
Tom - I made a schoolboy error initially as I didn't watch the byte size and instead I copied and pasted from the 'CMG' set up to the subsequent entry. This was two different text sizes between the two files, though, and I lost the VBA project just as Stewbob warned.
Using HxD, there is a counter tracking how much file you're selecting. Copy starting from CMG until the counter reads 8F (hex for 143) and likewise when pasting into the locked file - I ended up with twice the number of '..' at the end of the paste, which looked odd somehow and felt almost unnatural, but it worked.
I don't know if it is crucial, but I made sure I shut both the hex editor and excel down before reopening the file in Excel. I then had to go through the menus to open the VB Editor, into VBProject Properties and entered in the 'new' password to unlock the code.
I hope this helps.
ScoobScoob
My tool, VbaDiff, reads VBA directly from the file, so you can use it to recover protected VBA code from most office documents without resorting to a hex editor.
Chris SpicerChris Spicer1,73411 gold badge1010 silver badges2020 bronze badges
The protection is a simple text comparison in Excel.Load Excel in your favourite debugger (Ollydbg being my tool of choice), find the code that does the comparison and fix it to always return true, this should let you access the macros.
TrebTreb17.6k55 gold badges4848 silver badges8282 bronze badges
your excel file's extension change to xml.And open it in notepad.password text find in xml file.
Break Password Macro
you see like below line;
(sorry for my bad english)
Developer33Developer33
For Excel 2016 64-bit on a Windows 10 machine, I have used a hex editor to be able to change the password of a protected xla (have not tested this for any other extensions).Tip: create a backup before you do this.
The steps I took:
- Open the vba in the hex editor (for example XVI)
- Search on this DPB
- Change DPB to something else, like DPX
- Save it!
- Reopen the .xla, an error message will appear, just continue.
- You can now change the password of the .xla by opening the properties and go to the password tab.
I hope this helped some of you!
Edwin van der VEdwin van der V
If you work in
Java
you may try VBAMacroExtractor
. After extracting VBA scripts from .xlsm
I've found there password in plaintext.GrezGrez
protected by Robert Harvey♦Feb 11 '11 at 22:17
Macro To Break Vba Password Change
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Would you like to answer one of these unanswered questions instead?