Close Window   
Free Ebook
Get Your Free Excel
Our Top 15 Excel Tutorials
Instant Access!
Subscribe for Free Excel tips & more!

Unlock Vba Project

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More


I need to unlock the VBA project in an Excel file, but I don't know the

I know, that there is a brute-force password cracker for protected
worksheets, but only for worksheets - no VBA projects.

Is there any other tool for this?

Note that I already know, how to extract source codes from Excel file (using
modified ClamAV) - but I need also to modify it, not only extract...

Thanks in advance!


View Answers     

Similar Excel Tutorials

Password Protect Excel VBA Macros
How to password protect VBA code and macros in Excel so that a user cannot see the code or edit it or do anything ...
Delete a VBA Module From Excel
Delete a VBA macro module from Excel with this macro. This macro allows you to fully remove a macro module from Ex ...
Get a Date that is So Many Working Days Before or After a Date in Excel - WORKDAY
How to find a date that is so many days before or after a specified date, excluding weekends and any holidays. This ...
Allow Only Certain People to Edit Specific Cells in Excel
How to allow only certain people to edit certain cells or ranges in Excel. This is a security feature that you can ...

Helpful Excel Macros

Protect and Unprotect All Worksheets at Once
- This will allow you to protect or unprotct all worksheets in a workbook at once. It doesn't allow you to input a passwor
Hide Formulas in a Worksheet and Prevent Deletion
- This macro will hide all formulas within a workbook and not allow them to be deleted. The page will not be protected li
Name Worksheets Based on Cell Contents
- This macro allows you to have your worksheets named by whatever is in a particular cell within a worksheet. This means
Create a Bar Chart With a Macro in Excel
- Create a bar chart in Excel with this macro. You will be able to quickly and easily turn any range of numbers and data
Delete a VBA Module From Excel
- Delete a VBA macro module from Excel with this macro. This macro allows you to fully remove a macro module from Excel.

Similar Topics

Hi friends,

I want to change/reset VBA password for Access VBA projects from VBA code itself.

While googling, I found few code to unlock Excel VBA project but I was unable to modify them for access.

Basically I want to set/remove VBA password of one mdb file programatically from another mdb file. I'll be having the VBA password, so this is not for recovery purpose.

Thanks in advance.


Hi: We all know that we can protect our VBA Project Code from Viewing by checking the Protction Tab within VBA Project Properties and entering a password.

Question: In doing so, is a macro prevented from running without adding a line of code to unlock and lock the VBA Project Properties?

I have a portion of a macro that enters a checkmark to a Control Box Checkbox. The portion of said Macro ran fine until I locked the VBA Project Properties. Within the Macros, there is already a line of code to unlock the worksheet that is also password protected, but does one also have to unlock the VBA Project Properties in order to run a macro???

The first part of macro unlocks the sheet via:

ActiveSheet.Unprotect Password:="X"

However, the macros presents with error when asking a checkbox from the Control Toolbar to be checked when the VBA project Properties are locked vs working prior to locking the VBA Project Properties from viewing, The portion of the macro that ceases with a bug is:


For Each ctl In Worksheets("Sheet1").OLEObjects
If TypeOf ctl.Object Is MSForms.CheckBox Then
ctl.Object.Value = True
End If

Help is appreciated: Unlock VBA project Properties vs a better way to have a macro check a checkbox?

Is it possible to have a macro unlock all of the worksheets in a workbook, each worksheet is password protected (they all use the same password). It would be nice when I am updating the protected cells that I can unlock all of the spreadsheets at once and then lock all of them when I am done.


I have more than 30 excel files and each file has macros locked for viewing. I used the same password to lock the VBA Project of all the files.

To modify the macro codes (or VBA components procedure and code modules) in all those files stored in a different directory, I have developed a macro procedure to automate the process. I run into error becos the macros to be modified in the files are password-protected in the VBAProject property.

How can I include the known password in my procedure so that I can first unlock the VBAproject before I modify the code modules in the remote files. Thanks.


Pwd = InputBox("Please enter Password to unlock the workbook.")

For Each ws In ActiveWorkbook.Worksheets
ws.Unprotect Password:=Pwd
If Err  0 Then
        MsgBox "You have entered an incorect password. All worksheets could not " & _
        "be unprotected.", vbCritical, "Incorect Password"
    End If
    On Error GoTo 0

Next ws

End If

I am using this code so that users can unlock all worksheets with a password.

when users click "cancel" or supply the incorrect password, the debugger comes up and I don't want users to go to the VBA code.

I need to modify the code so that when users enter the wrong password the routine just exits ...

i tried doing it with the code above but doesn't work.

could anyone help ?

Hello Team,
I have one macro file which is password protected but I had missed out the password.....Can you please unlock the file for me.....If you want I can send the file to you as well...

Dear Forum

Please help with codes to extract multiple zip files into a specified folder.

Need to extract 1000s of zip file having one excel file in it. Every excel is password protected. Aware of the password and is also listed in an excel fie.

Can code be written to extract zip files which should lookup/check from the list of password stored and extract files / content to specified folder.

Please code at your earliest

Hello! I have addin containing several worksheets. The addin is an xlam file in excel 2007. Some of the worksheets contain vba codes (such as worksheet selection change event) in the sheet code module.The vba project of the add in is password protected. Some worksheets from the addin get copied to the current active workbook. The vba modules of addin can not be viewed because they are password protected. However the sheet codes of the copied worksheets from addin can be viewed. How can I password protect these worksheets codes?

So, I have my VBA project locked, and i still have the password,but for safety, i'd like to have a macro to unlock this password in case i forget it.
Is is possible?

Hi ,

I have an issue with unlock vba project.
I need to do following.
1). When vba project unlock message popup say "If wrong password attempt VBA CODE will delete"
2). If the user attempt more than three need to delete macro module.

If any body have any clue as how above mention two stept automate in excel(VBA MACRO) Please let me know.
Now I'm really sufferng with this issue. I gone though several thread, But no one has clear idea on that. Pleassss


I have a file created by someone who left the company and did not leave a password to unlock a protected sheet.
Is there a way to do this without a password?
It is a complex file, so I don't want to recreate it if I don't have to.


Hi Guys,

Can someone show me how I can unlock a range of sheets that are password protected in my workbook.

I have 20 identical sheets one for each department which are protected by the same password.

It would be nice if I could rapidly lock and unlock these sheets.

What I need a set rng command in conjunction with a For Next loop?

Thanks in advance.

I've noticed that, on occasion when I protect the vba modules with a password, and copy the Excel workbook containing the password-protected modules, to a different computer, when I then try to unprotect the vba files I get a status message that says "Project is unviewable" with a dialog title that says "Project Locked". I am not presented with the password entry dialog box as usual so am unable to enter my password to unlock the vba code.

Why does this happen?



Hello Everyone,

Would anyone be able to provide information on why I'm unable to save an Excel file when my VB project is password protected?

The message I receive is, "...You cannot save to this file format when the VBA Project is protected. You may unprotect the VBA project..."

The VB Editor is purposely locked (to not allow users the ability to modify code). It seems as though I have used many .xls files, where the VB Editor is password protected and I haven't had any issues saving the file.

Any ideas on what may be causing this?

Thanks in advance to everyone.

Hi. I hope that someone can help me with this.
I got this userform from my previous employer, this was a project that had been abandoned in a process. I would like to make it work but it is password protected.
Is there any chance to unlock it?
I have tried few password unlocking programmes but it always comes back with the message that spreadsheet isn't protected?????
I have almost gave up on it and you are my last chance :-)
I would be grateful if someone can help me with this.
Thank you


I have been sent a file to work upon..... it has a macro in it which i want to look at....

but when i try to open the vba project of this file a pop-up appears saying "project is unviewable".... it does not asks for any password also.....

I contacted the person who sent it to me and he said he never put any password to the vba project of the file .... he is also unable to see the project...

can anyone please tell me why I am getting this.... and how to open the project in vba....
how can it become unviewable when the creator did not put any kind of lock or protection to it... and had it be done the project should have atleast asked me to provide any password to view the codes..... please help...


Hi All,

A while ago I built a report template and had VBA protected with a password and now I can't find my notes which tells me what password i used.

I've searched the forums and a number of people say how easy it is to circumvent the vba protection but don't say how.

Can anyone give me any tips how to unlock this in some way without having to buy a password cracking tool?


I have a workbook in excel 2003 with no vba code, but which includes some sheets that are "veryhidden". The VBA project is locked with a password. When I try to open the project I am asked for the password and cannot view the veryhidden worksheets without this password. This seems to me to be how the password system is supposed to work.

I then copy the file to a computer running Excel 2007 and find that there is no protection on my VBA project. In the VB editor I can see all of the worksheets.

Does anyone know what has happenned? Is there a workaround. It seems that if the workbook has some VBA code, the protection does work, but not if the workbook contains no VBA code.

I have the age old issue of a member of staff having created a password protected VBA project. This member of staff has now left the company and not unlocked the project. Therefore it's not possible to make changes to the code.

Is there some code I can use to extract the password?

Or is there a method of recovering the password that doesn't involve spending money on password-recovery software?


I have a code in a sheet that refreshes a pivot table, but I have the sheet password protected. What do I put in the code to unlock the sheet with the password, refresh the data, and re-lock the sheet using that same passowrd? Thanks in advance.

Sorry here I'm again, after a first test
bob's code worked good, but I allready opened
my VB editor and the VBA project with the pasword...
After closing Excel and setting the program back
in its original state (with project Password protected)
I tried above again and it did not work, how can
i open the project (with password) in a macro ???

Hi all

I am in desperate need for a vb password cracker as i need to gain access to my VB project again but somehow can't remember my password...

Rather embarressing....

Ok, I know this has been asked and I know part of the answer. But I think I have a unique situation. (maybe).

I've got an excel file that compiles information and then breaks out the information into multiple workbooks using VBA. I copy code into the new workbooks for additional functions and due to some of the specifications I need to lock the sheets with a password but still allow some sorting. Which means I need to unlock and re-lock the sheets. Now putting in a password programmatically to lock/unlock sheets is no big deal. However, I need to lock the code up from viewing to prevent people from getting the worksheet password.

Is there a way to lock the VBA project programmatically after I transfer the code?
Or does anyone have a creative suggestion?

I've been asked to update an excel vba project that has been lock by someone
else. This person of course has left our company and nobody noknows what the
password is. What are the ways, if any to unlock this project.


Note: I am note trying to use this information for hacking. The company I work for is making us protect all our macros. We have thousands and I don't want to have to go into each one to see if it is protected.

Using vba in excel, I want to be able to test if the vba password is set. Using the below function I can tell most of the time. The only problem is if the "Lock project for viewing" isn't checked and a password is set, the below function will say it isn't protected but when you try to go into the properties it prompts you for a password. Is there a way to tell if it is protected even if they didn't check "Lock project for viewing"?

Function ProtectedVBProject(ByVal wb As Workbook) As Boolean
' returns TRUE if the VB project in the active document is protected
Dim VBC As Integer
VBC = -1
On Error Resume Next
VBC = wb.VBProject.VBComponents.Count
On Error Goto 0
If VBC = -1 Then
ProtectedVBProject = True
ProtectedVBProject = False
End If
End Function