00:00If you have locked your VBA projects using a password, and you can't remember what the password is, this is
00:05how you unlock it.
00:06But before we do that, let me show you how you can lock your VBA projects using a password.
00:10You're going to press alternate F11, and that will launch your VBA editor.
00:15If that hotkey doesn't work, I've got another video showing you how you can enable that hotkey.
00:20If you need that link to that video, please leave a request on the comment section, and I'll send you
00:24the link.
00:25Now, once you open your VBA editor, you're going to scroll all the way up, and you're going to right
00:29-click on VBA projects that you're working on.
00:31This is the workbook I'm working on, the sheet.xlsm.
00:35That's why I'm going to right-click on this guy here, and click on VBA project properties.
00:38And this is going to bring up a VBA project properties window here.
00:41You're going to select Protection tab, and you're going to place a check next to the log project from viewing,
00:46and assign a password.
00:48My password will be ABC for this demonstration today, and click OK.
00:52Now, we're going to press Control-S to save, and basically close your workbook.
00:56And now, if you open your workbook, and press alternate F11 to launch your VBA editor, and try to open
01:02your VBA project,
01:04this time around, they'll prompt you for password.
01:06Of course, I know the password. It's going to be ABC, and it will unlock, and you can look at
01:11the VBA project itself.
01:13But in the event, if you have locked your VBA project with a password, and you can't remember the password,
01:20and you try to open your VBA project,
01:22this is the furthest you'll ever go without a password.
01:25Let me show you how you can get out from this sticky situation.
01:27You're going to basically close your workbook completely here, and then go to the location where your Excel workbook is
01:34located.
01:35Now, you're going to change the file name extension from XLSM to ZIP, ZIP, like this, and hit Enter.
01:43And Windows will say that you're about to change your file name extension.
01:46Of course, you're trying to do that. Say yes, and the icon will change, and the file icon will look
01:51like a zip file.
01:52Now, you're going to right-click, and basically extract the zip file into any directory.
01:58I'm going to unzip into the same directory where the zip file is, like this.
02:02And when you do that, what happens is that you'll create a brand new directory for you with the same
02:06name as the zip.
02:08Now, you're going to open this directory that was created by the unzipping process, and this will bring you to
02:13this directory here.
02:14Over here, you're going to open your Excel directory here, and if you scroll down after opening Excel directory,
02:19you'll see a file called VBAproject.bin, or binary file.
02:24You're going to have to use a hex editor to look at the content of this file.
02:28The hex editor I'm using today is called HXD.
02:31It's a free tool that you can download.
02:32I'll leave the description of where you can download this file from.
02:36Once you have installed the HXD, you're going to basically take that VBAproject binary and drag it into the HXD
02:42and let it go.
02:43And it will look something like that.
02:45Now, place your cursor at the very top end of that file, and press Ctrl-F, and look for something
02:50called DPB.
02:52And if you hit Enter, you will highlight the location where the text DPB is located.
02:57It will look something like that.
02:58Now, you have to carefully highlight only the B and replace it with the letter X.
03:03Once that is done, you're going to press Ctrl-S to save and close your hex editor.
03:08Now, let's go back one directory up, and you will see three directories and one file.
03:12You're going to select all of them here like this, and you're going to right-click and basically say compress
03:17to a zip file.
03:18When you do that, you'll create a brand new file, and you can reassign a name called maybe test.
03:24But make sure you change the file name extension from zip to XLSX, and hit Enter.
03:30At that point, the window is going to complain and say that you're about to change the file name extension.
03:34Of course, you're going to say yes here, and the icon will change from a zip to an XL.
03:39Now, if you try to open this, window will say you have recovering to do.
03:43Of course, you're going to say yes.
03:45Another window will pop up again, saying that it contains invalid character.
03:49Of course, we made changes from DPB to DPX.
03:52You're going to say yes here, and here you're going to say it's about to do repair and all that.
03:56You're going to click on close here.
03:57Now, you're going to press Alternate F11 to launch your VBA editor.
04:01When you launch your VBA editor, it will give you this unexpected error.
04:05You're going to click on OK or press Escape.
04:07You'll see that I have multiple unexpected error, mainly because I got multiple VBA modules and script on this file
04:15here.
04:15That's why I get a multitude of it.
04:17So after a few rounds of pressing Escape or clicking on Close, you'll come up to a VBA editor here.
04:23Now, what you do is that you go all the way up to your VBA project.
04:26Try not to open it because, of course, if you try to open it, you'll get the same error as
04:30what you saw just now as unexpected error here.
04:33Let's go back to our VBA projects here.
04:35Right-click on it and go VBA project properties.
04:38In here, you're going to go back to the same tab called Protection and remove this log project from viewing.
04:44And make sure there's no password on this password section here.
04:47Now, you're going to click OK and close this and press Control-S to save.
04:51When you do that, they'll ask you to save this file as a separate file somewhere else.
04:55I'm going to browse and basically maybe go one directory above, which is going to be in this directory.
05:01Give you the file name called Tests.
05:02Maybe I'm going to call it DesSheet again.
05:04No password.
05:06And I'm going to leave the file name extension as XLSM.
05:09And I'm going to click on Save.
05:10And what it does is that it creates a brand new file for you right here.
05:15You can see.
05:16I'm going to close this.
05:17Once that's done, you're going to open the same file that you just created.
05:21And this time around, if you press Alt F11, the VBA editor will open.
05:27And you've got full access to your VBA projects without a password.
Comments