Byothe.frxFSHow to bypass password of a VBA project in Excel...

How to bypass password of VBA project in Excel?

For my job, I use Excel a lot and I have been working with VBA for many years to simplify my life by automating certain boring tasks. So that colleagues who are less comfortable with Excel do not come and spoil my files and my code, I have protected it with a password. However, as time went by, I forgot some passwords on old files.

Well, you'll see that in the end it's not that difficult to break this password! And that should make you think twice about the real security of your excel files protected by mot de passe !

Protect your VBA project with a password

If you're reading this article, chances are you already know how to password protect a VBA project. But here's a quick reminder for those who want to get started. The steps are relatively similar, regardless of your version of Excel. In my case, I used Excel 2016.

So to get started, head over to the tab Junior Backend Developer (Intern) And click Macros.

excel vba password 1

If you don't see the Developer tab, go to File> Options and then Customize the ribbon. Select Junior Backend Developer (Intern) in the left window and press Add>> to integrate it into the menu.

excel vba password 2

Once you have selected Macros in the tab Junior Backend Developer (Intern), enter a name for your macro (it doesn't matter, it's just to have something to password protect) and click Create.

excel vba password 3

Copy and paste the following code into your macro… It’s a very simple macro that will write a piece of text in cell A1 and whose only purpose is to have something to protect.

Range("A1").Value = "Password cracked!!"

And you should have something like this in your VBA editor:

excel vba password 4

In the VBA editor, go to Tools > VBAProject Properties… Select the tab Protection and you will be able to define a password! Also remember to check the box Lock the project for viewing so no one can see this mind-blowing code!

excel vba password 5

Press OK and save your file in XLSM format (the one that supports macros). We will be able to test if the manipulation worked. To do this, close and reopen your Excel file then go to the tab Junior Backend Developer (Intern) And click Visual Basic.

When you want to go to the VBA project that interests us, a window will open to ask for the password.

excel vba password 6

Now we can try to crack this password!

How to remove a VBA password?

Now let's move on to the difficult part... don't worry, nothing really complicated and we'll see everything together step by step. Before anything else,e, make a backup of the file that you want to crack, in case the method doesn't work.

First, we're going to need to use a hex editor. If you don't have one, HxD is a good free option, but there are plenty of alternatives available.

Preparing our XLSM file

In the case of an XLSM file (files with Macro from recent versions of Excel), you will have to do a little additional manipulation compared to an XLS file.

Find the file on your Hard disk, then rename it by adding .zip at the end.

Then open it with an archive compression software like WINRAR, IZArc or just Windows Explorer on Windows 10. You should then find a folder there labeled xl.

excel vba password 7

In this folder, look for the file called vbaProject.bin, extract it and open it with your hex editor.

excel vba password 8

If your file is in XLS format, open it directly in the hex editor without changing the extension!

Disable password

This is where it comes in handy to know how to set up a password.

In fact, you will have to create a new fake Excel document, add a macro to it and define a password (which you will have to remember) as described at the beginning of this article. This file will be used to crack the file on which you want to remove the password. The idea is that we will take the hexadecimal code that indicates the password and insert it into the file we want to access. Basically, it's a transplant!

That's why with this dummy file, you have to reproduce all the steps until extracting the vbaProject.bin file.

You should now have both of your vbaProject.bin files open in your hex editor. Don't mix them up!!!

Use Ctrl + F in the editor to find the following characters:

CMG=

This is the beginning of the code that indicates the current password. We need to copy and paste three values ​​and their contents:

CMG=
DPB=
GC=

And this is what it gives:

excel vba password 9

Transfer this code to your other vbaProject.bin file, and place it in the same place (where you find the 3 aforementioned values ​​CMG, DPB and CG), making sure not to delete anything else. Save your edited hex file.

Now, delete the original vbaProject.bin file from the document we are trying to remove protections from. Replace it with your edited vbaProject.bin file, then change its filename from .zip to .xlms or .xls depending on what you originally had.

Open your file in Excel.

Go to the tab Junior Backend Developer (Intern) And click Visual Basic. Then try again to access the VBA project you want to unlock. A window will ask you for your password.

Normally, if everything worked, the password that will work is the one you created for the second document, the dummy document.

What if it doesn't work?

If you ever have a problem and Excel tells you that the file is corrupt, you will have to try again with a copy of the backup of the file that you made. The reason for this problem is that the string of characters that you pasted to replace the one in the file to be cracked was longer than the one in the fake file.

In this case, you need to add 0s (zeros) to the string you are pasting, just before the final quotes.

CMG="xxxxxx"\r\nDPB="xxxxxxxx"\r\nGC="xxxxxxxxxx"

CMG="XXXX00"\r\nDPB="XXXXX000"\r\nGC="XXXXXX0000"

In the second string, we added 0s so that it would be the same length as the original one in the file to be cracked!

Please let us know if you have simpler solutions or if you don't understand, in the comments below!

Article updated on February 27, 2026 by Byothe

Byothe
Byothehttps://byothe.fr
As a forty-something dad fascinated by the web, I spend a lot of my time keeping watch to find you the best news. Tips and tricks, humor, websites and high-tech are the main subjects I want to cover here… but I will not fail to offer you good deals gleaned here and there on the web…

Related articles

23 COMMENTS

  1. Hello, I have the opposite problem, the string I want to paste is larger than the string in the file to be cracked. How can I do this?
    Kind regards.

    • Hello, this was my case, you have to delete a few characters from the original string, for me it worked! (even if it seems strange ^^)

      • Hello, did you delete random characters?
        Personally it doesn't work and I'm not surprised, even though it has the same initial problem (the string I'm trying to insert is longer than that of the file to be cracked).
        I would appreciate any information because I have tried several variations but nothing works, I am unable to activate the content without errors.
        thank you in advance

        • Hello,
          Has anyone found a solution please?
          My string from the dummy file to paste is also longer than the one from the file to crack. I tried copying the entire string, I also tried removing the last characters, both times without success.
          thank you in advance

          • Hello,
            You need to make another fake password in the first file, shorter. I put "0000" first and the hex was too long. I changed it to "000" and the hex was shorter. I was able to add zeros to the end of the hex strings that were too short.

  2. Hello,

    I followed the steps, (fake file with password1; I insert the hex codes of the file to unlock with 00 for the length in the fake bin, I save the .bin; I put the .bin in place of the one in the file to unlock). My macros are not corrupted but yet the password password1 is not the right one.
    I checked on my dummy file, the password1 is indeed the one I enter in the file to unlock.
    Any idea what the problem is?

      • It's good I succeeded. I inserted the fake code in the .bin file of the file I'm trying to unlock. Added 0s if too short and left as is if longer. It works.
        I had understood the manipulation in the wrong way.
        Thank you for this tip.
        (it may deserve to be clearer 🙂 )

        • Hi,
          I did as you said, I inserted the fake code in the .bin that I want to open, and I added 0s in the 1st category only because the others are longer. I then replaced the .bin of the file I want to open with the new .bin that I just edited. the password is still incorrect.

      • Hello,
        Great, on the first try, I cracked an Excel function pack.
        Simple in fact, you just had to use your gray matter.
        I have a lot of projects in mind now. lol
        Thank you very much

  3. Hello,

    It doesn't work for me or I don't understand anything.
    no problem finding the parts of the codes concerned.

    Then I delete the part of the code to be cracked and replace it with the code from the dummy file.
    Where it gets complicated in my opinion is to add the number of 0 because the password of the file to be replaced is longer than that of the dummy file.
    I added "0" at the end of the string depending on the length of each part but it doesn't work. I have a new file that appears when saving. It's called vbaProjectBinBak :'(
    I tried to rename the file but it seems impossible
    Has anyone had this problem before?

    Can I post the 2 codes for further explanation?
    thank you in advance

  4. Hello,
    Not easy at all, but I was able to change the password thanks to this great tutorial. Thank you very much for this work and sharing.

  5. Hello,

    I have a problem with the handling.
    When I want to unfold my project in the developer tab, a message appears: "Project locked: The project cannot be displayed".

    An idea ?

  6. Hello,

    Thanks for this tutorial, is it normal that I can't edit the vbaProject.bin file in the zip?

    I also tried by performing the extraction then going through the steps then re-zipping my previously zipped folder.

    I find myself with a corrupted file, however my lines to modify are longer than those proposed

    Cdlt,

  7. Hello,

    After much research I do not have an XL file that I can do nothing to remove this password that our former colleague left us when she left. Once the xlsx is zipped, I only have MsoDataStore, DataSpaces EncryptedPackage EncrytionInfo DocumentSummary and SummaryInformation files…..help please!! 🙂

  8. The problem for me is that after saving, this creates another folder "vbaProject.bin.bak" instead of saving only "vbaProject.bin".
    Now I don't know what to do

LEAVE A COMMENT

Please enter your comment!
Please enter your name here


Discord

Want to chat live? Come and meet us on the Byothe.fr Discord server

Newsletter

Subscribe and receive a summary of web news every Monday

Latest news

Randomly