Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

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.

Table of Contents

Understanding Break VBA password requires more than a headline. The overview below breaks down the key facts, changes, and user impact.

Break VBA Password Overview

  • Create your own Internet "browser" with VBA
  • 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 – How to Set a Password

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 – How to Set a Password (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 – How to Set a Password (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 – How to Set a Password (4)

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

How to Break VBA Password in Excel – How to Set a Password (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 – How to Set a Password (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 – How to Set a Password (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 – How to Break the Password (8)

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

How to Break VBA Password in Excel – How to Break the Password (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 – How to Break the Password (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 – How to Break the Password (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 at the time present in Excel. In general, in an emergency, you can use this method to open the VBA password in Excel.

FAQ

How does Break VBA password work?

Understanding Break VBA password requires more than a headline.

What should you prepare before using this method?

The overview below breaks down the key facts, changes, and user impact.

What should you do if the process does not work as expected?

Break VBA Password Overview Create your own Internet "browser" with VBA OpenOffice.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.