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 .

Picture 1 of How to break VBA password in Excel

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.

Picture 2 of How to break VBA password in Excel

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.

Picture 3 of How to break VBA password in Excel

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.

Picture 4 of How to break VBA password in Excel

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

Picture 5 of How to break VBA password in Excel

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

Picture 6 of How to break VBA password in Excel

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 .

Picture 7 of How to break VBA password in Excel

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.

Picture 8 of How to break VBA password in Excel

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

Picture 9 of How to break VBA password in Excel

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.

Picture 10 of How to break VBA password in Excel

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.

Picture 11 of How to break VBA password in Excel

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.

Update 25 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile