Family Encyclopedia >> Work

How to recover Excel VBA password

Stuck with a VBA document that is password protected? Here is how to pick the lock.

Before you share an Excel spreadsheet, make sure you do these things first. Before sharing an Excel spreadsheet. Be sure to do these things first. Sharing is a convenient way to collaborate on Excel workbooks, but before you put your Excel files in the hands of others, prepare your worksheets for sharing with these tips. Read More The transition usually goes smoothly, but there are hiccups that can cause some real headaches.

For example, six months later, you can try to edit one of the VBA macros. The Excel VBA Programming Tutorial for Beginners. Excel VBA Programming Tutorial for VBA Beginners is a powerful Microsoft Office tool. You can use it to automate tasks with macros, set triggers, and much more. We will introduce you to basic Excel visual programming with a simple project. Read More What happens now? Well, with a bit of tinkering behind the scenes, it's not too hard to remove that protection entirely.

Here's how to remove password protection from a VBA document in Excel. It might just make you think twice about the security of your spreadsheets.

How to set a password

If you need to crack a password 560 million old passwords have been leaked online 560 million old passwords have been leaked online It's probably time to change your passwords again. Because a huge database of 560 million login credentials has been found online, waiting to be discovered by users. Read More However, it is still worth explaining how this type of protection works.

Go to the Developer tab in Excel and click Macros .

How to recover Excel VBA password

In case you don't see the Developer tab, go to File> Options and then Customize Ribbon . Now move the Developer group command from the left pane to the right.

How to recover Excel VBA password

Once you have selected Macros in the Developer tab, enter a name for your macro (it's just an example, so the details don't matter), and then click Create .

How to recover Excel VBA password

Copy and paste the following code into the Visual Basic Editor. This is a simple macro that will enter the quoted text into cell A1. It has no real purpose, but we need something to protect with a password.

Rango ("A1"). Valor = "Protegido por contraseña"

You should end up with something that looks like this.

How to recover Excel VBA password

In the Visual Basic Editor, navigate to Tools> VBAProject properties .

How to recover Excel VBA password

Go to the Protection tab and you can set a password. You will also need to check the box labeled. Lock project to view .

How to recover Excel VBA password

Click OK , make sure to save your Excel document as an XLSM file, and we can test if our password works. Close your document and reopen it, then go to the Developer tab and click Visual Basic .

How to recover Excel VBA password

When you try to access the relevant VBAProject, you will see a password prompt How to Password Protect Windows 10 How to Password Protect Windows 10 Your computer is a goldmine of personal and private information. Fortunately, Windows 10 has a number of lockdown methods to help protect your data. Let's take a look at how you can password protect Windows... Read More Now we can figure out how to remove this type of protection.

How to remove a password

Now for the hard part, although it's pretty easy once you know what you're doing. First, we'll need to download a hex editor. What Is A Hex Editor And Why You Might Use It [Technology Explained] What Is A Hex Editor And Why You Might Use It [Technology Explained] Read more. If you don't already have one, HxD is a good free option, but there are plenty of alternatives available.

Our process differs slightly depending on whether we are cracking a password in an older XLS file or a newer XLSM file. If you're working with the former, feel free to skip the next section.

Preparing our XLSM file

We need to do some additional preparatory work to remove a password from an XLSM file. Find it on your hard drive, then rename it, adding .zip at the end.

Then open it with file compression software. The 3 best file compression and extraction programs. The 3 best file compression and extraction programs. Need to compress a large file? There is no shortage of file compression and archiving applications for Windows. But which zip file is best for you? Here are our top three picks. Read More You should find a folder labeled SG .

How to recover Excel VBA password

Inside this folder, you are looking for a file named vbaProject.bin .

How to recover Excel VBA password

Extract this file and open it with your Hex Editor.

Disabling the password

This is where being able to set a password comes in handy. Create a dummy Excel document, add a macro to it, and set a password as described at the beginning of this article. Next, we're going to take the hexadecimal code that stipulates what the password is and insert it into the file we want to access.

Once you've configured that file, save it and go through the same process we did a minute ago so you end up with another vbaProject.bin file. Make Sure You Remember Your Password 4 Reasons Password Managers Aren't Enough To Keep Your Passwords Safe 4 Reasons Password Managers Aren't Enough To Keep Your Passwords Safe Password managers are valuable in the ongoing battle against hackers, but they do not offer enough protection on their own. These four reasons show why password managers are not enough to keep your passwords safe. Read more !

You should now have both vbaProject.bin files open in your Hex Editor. Don't confuse them or we're going to have big problems..

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

CMG =

This is the beginning of the code that stipulates the current password. We need to copy and paste three values:

CMG = DPB = GC =

Below you can see how I did it..

How to recover Excel VBA password

Transfer this code to your other vbaProject.bin file and place it in the appropriate position, making sure you don't delete anything else. Save your edited hex file.

Now delete the original vbaProject.bin file from the document we are trying to remove the protections from. Replace it with your edited vbaProject.bin file, then rename your .zip file name back to .xlms or .xls.

Open the file in Excel. Go to the Developer tab and click on Visual Basic, and try accessing the Project menu. You should see the password prompt and hopefully the correct password should be the one we set in our fill document.

How to recover Excel VBA password

We are back in the document! Now you can get along with whatever you have to do.

Notes on Beating the System

This trick can be very useful when you're on a link, and you desperately need access to a password-protected VBA macro. However, it should also illustrate a major security flaw that is present in Excel.

If you are using this type of password protection to defend your VBA code, know that there is a workaround. At best, it's a deterrent:anyone with the ability to do a Google search will know exactly how to remove your defenses.

It just goes to show how important it is for us to constantly question our security practices. How to Apply Password Protection How to Password Protect and Encrypt Your Microsoft Office Files How to Password Protect and Encrypt Your Microsoft Office Files Would you mind if someone peeked through your OneNote notebooks or had access to your documents? Word? If your answer is yes, let us show you how to protect your Office files. It may seem like Read More offers a valuable mindset, but in a situation like this, it's not as effective.

Do you have questions about removing password protection from an Excel document? Or do you have a safety tip you want to share with others? Why not join the conversation in the comments section below?