Many users secure their Excel files with passwords to prevent unauthorized access or modification. However, there might be instances when users forget the password, rendering the file inaccessible or uneditable. This can be frustrating, especially since many users risk losing important data, similar to when your computer files disappear. Fear not, as this article will present several useful methods to unlock an Excel file if you've forgotten its password. Below are three of the simplest and most successful ways to unlock your Excel file.
What if you have multiple files and you forget the password for one of them, and you want to change it? Let's see how to do that.
Step 1. Open Excel and switch to the password-protected worksheet. Press Alt + F11 to open the Microsoft Visual Basic Applications window.
Step 2: In the left pane, select the workbook and right-click it. From the context menu, choose Insert > Module. Next, copy and paste the following code into the code window of the protected worksheet, which you can select in the left pane.
Sub PasswordCracker()
This line of code declares three integer variables named i, j, and k. In VBScript or a similar programming language, the "Dim" keyword is used to define the type and name of the variables. Here, "Integer" indicates that these variables will store integer values.
Declare three integer variables, l, m, and n.
Declare three integer variables, i1, i2, and i3.
Declare three integer variables, i4, i5, and i6.
"On Error Resume Next" is a statement in Visual Basic or a similar programming language that indicates if an error occurs, the program will not stop executing but will continue running the next line of code instead. It is commonly used for error handling, allowing programmers to skip over an error and proceed with the rest of the program rather than immediately terminating. However, it should be used with caution as it can lead to overlooking serious errors or produce unintended results.
For i from 65 to 66: For j from 65 to 66: For k from 65 to 66
For l = 65 to 66: For m = 65 to 66: For i1 = 65 to 66
For i2 = 65 to 66: For i3 = 65 to 66: For i4 = 65 to 66
For i5 from 65 to 66: For i6 from 65 to 66: For n from 32 to 126
The active worksheet is currently protected with a password that is the string concatenation result of Chr(i) & Chr(j) & Chr(k) & _. Here, i, j, and k are variables representing character codes.
This string represents VBScript or VBA code that concatenates several ASCII characters together. The `Chr()` function is used to convert ASCII integer values into their corresponding characters. Specifically: - `Chr(l)`: Converts the ASCII value of variable `l` into a character. - `Chr(m)`: Converts the ASCII value of variable `m` into a character. - `Chr(i1)`: Converts the ASCII value of variable `i1` into a character. - `Chr(i2)`: Converts the ASCII value of variable `i2` into a character. - `Chr(i3)`: Converts the ASCII value of variable `i3` into a character. The underscore at the end (`_`) indicates that the line of code continues on the next line. The actual code might look like this: ```vbscript Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & SomeVariable ``` Here, `SomeVariable` would be another ASCII value or a string to concatenate. The overall expression results in a string composed of multiple characters.
Concatenate the characters with ASCII values i4, i5, i6, and n.
If the ProtectContents property of the active worksheet is False, run the code.
MsgBox "An available password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & "_"
Concatenate the characters with ASCII values i3, i4, i5, i6, and n.
"Exit subroutine"
If it's over,
Next: Next: Next: Next: Next:
Next: Next: Next: Next: Next:
This is an end marker for a subroutine in VBScript (Visual Basic Script), indicating that the code for the subroutine ends here. In Chinese, it can be roughly understood as "Subroutine End."
Step 3: Press F5 to run the code. You can also run the script by going to "Run" > "Run Macro."
This may take a few moments. When it's done, a pop-up will appear with the password. Click “OK,” and your spreadsheet will be unprotected.
Using this method, you can quickly remove the password protection from an Excel file and change its extension. Although it's slightly more complex, you can follow these steps using WinRAR: 1. First, download and install WinRAR software. 2. Locate the Excel file you want to remove the password protection from, right-click on it, and select "Add to Archive." 3. In the WinRAR window that appears, uncheck the "Set password" option to ensure no password is set. 4. Click the "Browse" button, choose a new save location, and in the "File name" field, change the file's extension to ".rar" (for example, if the original file is named "file.xlsx," rename it to "file.rar"). 5. Verify that all settings are correct, then click "OK" to start the compression process. 6. Once the compression is complete, find the newly created RAR file, right-click on it, and select "Extract Here" or "Extract to Current Folder." 7. WinRAR will now decompress the file, creating a new Excel file without the original password protection. 8. Finally, rename the newly generated Excel file back to its original extension (e.g., change "file.rar" back to "file.xlsx") and open it to check if the password protection has been successfully removed. Please note that this method might not work for all types of password protection, and if the original file has strong encryption, it might not be successful.
Note: Before you begin, make a copy of the protected Excel file, in case it becomes damaged.
Step 1: Right-click the copied Excel file and rename it by changing the .xlsx extension to .zip. Click "Yes" when prompted.
Note: To view your file extension, go to File Explorer, click the View tab, and then click File name extensions under Show/hide.
Step 2. Next, double-click on your ZIP file to open a window with the spreadsheet's components. Select the xl folder.
Step 3: Inside the “Worksheets” folder, you'll see individual .xml files for each worksheet. Copy and paste the protected sheet that you want to unprotect onto your desktop.
Step 4: Right-click the protected sheet and select Open With > Notepad or any other text editor.
Step 5: Press "Ctrl + F," and then type protect in the search bar.
Step 6: Next, select all the code that begins with sheetProtection and goes all the way to its closing tag (the > symbol), and delete it.
Step 7: Close the window and save your changes.
Step 8: Remove the old XML-based protected sheet from the workbook folder.
Step 9. Copy and paste the modified .xml file back into your spreadsheet's folder.
Step 10: Click OK in the Archive Name and Settings dialog box.
Step 11: Next, close the window and return to the Excel file where you changed the filename extension to .zip. Rename the file with the .xlsx extension. Click OK when prompted.
Now open your Excel file and check that you are able to make changes to the unprotected sheets.
This method only works for Excel files that have some of the worksheet locked. If the entire file is protected, you won't be able to open the spreadsheet.
Step 1: Open your Excel spreadsheet and go to the “Review” tab.
Step 2: Click on the “Unprotect Sheet” option. A pop-up window will appear asking for the password.
Step 3: Enter your password and click OK.
Your Excel spreadsheet is not protected.
Most small and large corporations use Excel files to keep track of their finances, growth, production, and so on. When all the information is contained within an Excel file, protecting them becomes crucial. Hence, with possibly so many files, remembering passwords can be difficult.
So, if you ever find yourself locked out of an Excel spreadsheet (you set a password but can't remember it), these three simple methods will come in handy.