Computer

Know How to Set and Remove Excel VBA Password

In this article, I am going to show you how to set a password in VBA macro file and after that how to remove the password using two different methods.

Set Excel VBA Password

    • First of all, create a demo Excel macro in which you want to set VBA password.

Code: Range("A1").Value = "This is secret code"

    • Now from Microsoft Visual Basic for Application header part click on Tools > and from drop down window select VBAProject Properties…

    • In Project Properties windows click on Protection tab > check Lock project for viewing > enter a password that you want to set and click on OK button.

    • Save and close the Excel file.
    • Reopen the Excel file, now when you try to view VBA code the following window will appear.

Here you cannot see or edit the macro code without the password but still can execute the code by clicking on the command button.

If you want to restrict VBA macro from being executed without password then add below-mentioned code line:

Dim password As Variant
password = Application.InputBox("Enter Password", "Password Protected")
Select Case password
Case Is = False
'do nothing
Case Is = "easy"
Range("A1").Value = "This is secret code"
Case Else
MsgBox "Incorrect Password"
End Select

Now when you click on command button to execute the VBA macro the following screen will appear

Remove Excel VBA Password

    • To remove Excel VBA password, open Excel file with Hex Editor.
    • Now search DPB.

    • Replace DPB with DPx and save the file.

    • Now open file in MS Excel, if a pop up appear saying Continue Loading Project click on Yes button.

    • In Excel open VBA editor by pressing F11.
    • Now right click on VBA project and select properties. In Project Property window open Protection tab > uncheck Lock project for viewing and click on OK button.

  • Save the file and close it.
  • Open Excel file again, now you can edit and edit VBA macro.

Alternate Solution of Remove Excel VBA Password

If the above-mentioned method doesn’t work for you then you can take the help of third-party VBA password breaker tool to remove Excel VBA password. The software allows you to recover lost and forgotten the password of your VBA file. It first removes old Excel VBA password and then generates a new password to access your macro file. The software can remove password of any length and the password created with multiple combinations can also be removed the software.

Conclusion

In this article, I have shown you how to set and remove Excel VBA password. Setting a password in VBA file is an easy task but the password removal process is difficult to do. So in this blog, I have mentioned two different methods to remove Excel VBA password. If the manual method doesn’t work for you then you can take the help of automated VBA password breaker tool to do the same.

Be the FIRST to Know - Join Our Mailing List!

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Previous ArticleNext Article
As author of MS Outlook Tools, Peter has experience more than 20 years in IT industry and he is now working with an expert data recovery firm. He has quality expertise in the Office products especially in Microsoft Outlook and love to solve users query by providing excellent solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Send this to a friend