VBA Runtime error 1004

Resolve VBA Runtime error 1004: The Password You Supplied is Not Correct

Want to troubleshoot VBA Runtime error 1004? Looking for a trouble-free solution to fix VBA error “The password you supplied is not correct”? If you are also searching for such queries then you have landed to a right page. Read the blog carefully to resolve this error.

VBA Runtime error 1004

“Hello Guys, I have created a VBA Project and writing a macro code. The thing I need is to clear the content of the cells in the range. There is a strange scenario I am facing is while running the macro code sometimes, it gives result through without any problem. On the other hand, sometimes there is a VBA Runtime error 1004: “The Password You Supplied is Not Correct”.

I am not getting what the exact issue is. If anyone can help, please let me know how to resolve this error.”

Visual Basic Application (VBA), a platform used to create projects through Microsoft Excel, Word, Access, PPT applications with an ease and perfection. It is a file extension that contains the source code using Visual Basic program. Excel, Word, PowerPoint, are some popular applications among Microsoft users and these are used worldwide to store, organize and to manipulate the users data.

These applications are accessed by both the individual and business user and to create projects  using Visual Basic platform. But apart from its popularity, it is found this gets corrupted and due to this, it starts showing Runtime error 1004. Besides this, when users try to run macros on a protected worksheet and make any changes to it, an error message is encountered i.e., “Run-time error ‘1004’ application-defined or object-defined error”.

Therefore, in the upcoming section, we will discuss a step-by-step guide to fix “VBA runtime error 1004 password”.

Manually Resolve “Runtime Error 1004 VBA Password”

Go through the following set of instructions by which users can fix “Microsoft visual basic runtime error 1004”. Let us have a look:

  • Protect a worksheet using Visual Basic

Protect Wordsheet

Whenever you safeguard a worksheet, you are protecting a user from changing the values in cells and making some changes to the worksheet. Thus, users can simply protect a worksheet by executing the following code:

Runtime error

or, the Password might be optional,

VBA error

By default, each cell is locked, but this will not take effect until you keep the worksheet safe. When you save a sheet, all cells are getting locked except those that you have specially unlocked.

To unprotect the sheet, depending on whether the Password was provided during protection.

Error 1004

If the password is neglected, you can unprotect a workbook or worksheet without determining a password.

Note: In case, if you forget the password, you are unable to unprotect a worksheet or workbook or getting VBA runtime error 1004 password.

When you insert the code using VBA Code add-in then, all arguments are explicitly set. This will make it clear that all default features are protected (by default) or not. This becomes simple and easy to decide in which case you need to vary from the defaults.

Resolve Runtime error 1004

  • Error Handler in VBA

To overcome the first constraint wherein a worksheet will remain unprotected upon the code encountered an error, you can also use ErrorHandler, as given below:

Password is Not Correct

On Error Statements explained:

On Error Resume Next: It can specify that when the run-time error occurs, full control goes to the statement instantly where an error has occurred, and execution will continue from that point.

The On Error GoTo 0 statement will turn off the error trapping.  It can disable the enabled error handler in the latest procedure and resetting it with Nothing.

On Error GoTo Line: It enables an error-handling routine which starts at a particular line. The On Error GoTo statement will trap all errors, in spite of the exception class.

A Reliable Way to Resolve “VBA Runtime error 1004 Password”

If the above-stated procedure does not work fine thus, users can opt for a reliable third-party tool i.e., VBA Password Recovery tool. It is designed in such a way to recover password from a single protected VBA File without any difficulty. It can remove the older password and automatically creates a new VBA password. It can unlock and recover VBA Project password of any length in a hassle-free way. In fact, it can regain multilingual source code passwords of the VBA project i.e., the passwords made up of symbols and alphabets too. It has a user-friendly interface that even a novice user can use it without taking any external help.

Bottom Line

After going through this, one can easily  troubleshoot the runtime VBA error 1004. In the above-discussion, we have discussed all manual solutions that will help to resolve “VBA Runtime error 1004 Password” in detail. Also, we have suggested a commercial solution named as VBA Password Recovery tool.

It is one of the best solutions that will help to remove and recover password from the protected VBA file. The solution to unlock password protected VBA document is easy carry out  and it opens the VBA project file without losing any data.