How to break VBA password in Excel

If you use VBA protected password in Excel but don't remember the password, please read the article below to remove that VBA password.

If you use VBA protected password in Excel but don't remember the password, please read the article below to remove that VBA password.

  1. Create your own Internet "browser" with VBA
  2. OpenOffice.org Calc adds Excel VBA support

How to set a password

If you are trying to crack the VBA password, you probably already know how to set it up. However, here, I will talk about how to set up this type of protection.

Go to the Developer tab in Excel and click Macros .

How to break VBA password in Excel Picture 1How to break VBA password in Excel Picture 1

If you don't see the Developer tab, go to File> Options , then select Customize Ribbon . Now move the Developer command group from the left panel to the right.

How to break VBA password in Excel Picture 2How to break VBA password in Excel Picture 2

Once you have selected Macros in the Developer tab, enter a name for your Macro (this is just an example, so you can enter another name as you like), then click Create.

How to break VBA password in Excel Picture 3How to break VBA password in Excel Picture 3

Copy and paste the code below into the Visual Basic Editor. This is a simple macro that allows the text to be quoted in cell A1. It has no real purpose, but here, we need to create a file for password protection.

Range ("A1"). Value = "Password Protected"

You should end up like this.

How to break VBA password in Excel Picture 4How to break VBA password in Excel Picture 4

In Visual Basic Editor, navigate to Tools> VBAProject Properties .

How to break VBA password in Excel Picture 5How to break VBA password in Excel Picture 5

Go to the Protection tab to set the password. You also need to check the box next to Lock project for viewing .

How to break VBA password in Excel Picture 6How to break VBA password in Excel Picture 6

Click OK, make sure you saved the Excel document as an XLSM file. Now we can check if the newly created password is working. Close the document, then reopen, go to the Developer tab and click Visual Basic .

How to break VBA password in Excel Picture 7How to break VBA password in Excel Picture 7

When you access the VBAProject document, you will see a prompt to enter the password. Now we are looking for a way to remove this password.

How to break the password

First, we will need to download a Hex editor. If you haven't already, HxD (application for hex code editing) will be a good free alternative.

Download HxD

Download Hex

This process will be slightly different depending on whether we are cracking the password in the old XLS file or the new XLSM file. If you are working with an old file, you can skip the section below.

Prepare XLSM file

We need to do some extra work to clear the password from the XLSM file. Find the XLSM file on your hard drive, then rename it, add the .zip extension at the end.

Next, open the file using compression software like WinRAR or 7-Zip. You should find a directory named xl.

How to break VBA password in Excel Picture 8How to break VBA password in Excel Picture 8

In this directory, you need to search for a file named vbaProject.bin .

How to break VBA password in Excel Picture 9How to break VBA password in Excel Picture 9

Extract this file and open it with Hex Editor.

Disable password

This is the time to set another password. Create a virtual Excel document, add Macro to it and set the password as described above. Next, we will get the specified Hex code and insert it into the file we want to access.

Once you have set up the file, save it and do the same as the closing process of the vbaProject.bin file above. Remember the password!

Now, you will have both files vbaProject.bin open in Hex Editor.

Use Ctrl + F in the file you created to find the string below:

CMG =

This is the beginning of the code that defines the current password. We need to copy and paste the following 3 values:

CMG =
DPB =
GC =

Below you can see how I do it.

How to break VBA password in Excel Picture 10How to break VBA password in Excel Picture 10

Move this code to another vbaProject.bin file and place it in the corresponding location. Save the modified hex file.

Now delete the original vbaProject.bin file from the document that we are trying to remove the password. Replace it with the edited vbaProject.bin file, then rename its file from .zip to .xlms or .xls.

Open the file in Excel. Go back to the Developer tab and click Visual Basic, then try accessing the Project menu. You should see the password prompt window, the password here is exactly what we set up in the virtual Excel document.

How to break VBA password in Excel Picture 11How to break VBA password in Excel Picture 11

So you can access the file again.

Conclude

This trick can be very handy when you forget your password and you need to access a password-protected VBA Macro right away. However, it will also illustrate a major security vulnerability currently present in Excel. In general, in an emergency, you can use this method to open the VBA password in Excel.

4.1 ★ | 77 Vote