Users use passwords to protect their Excel files or worksheets. Unfortunately, there are numerous cases where users also forget their passwords. As a result, users need to recover Excel file password to be able to use their files from time to time. There are numerous tools or software online or offline to remove or recover Excel file passwords. However, we’ll not use any online or offline exclusive tool or software to retrieve Excel file passwords.
In this article, we demonstrate ways to recover or remove an Excel file password using VBA Macro and Zip Tool (Winrar or 7 Zip).
Download Excel Workbook
Excel File Encryption Types
There are two kinds of Excel file encryptions. They are:
🔄 Encrypt the Excel Workbook with Password. This encryption requires passwords to open or view the file.
🔺 If you open the encrypted file, excel will display a Password window to input the password to open or view it.
🔄 File encryption with Protect Sheet offers only the Excel worksheet protection. In that case, the user needs to enter his/her password to edit or modify the worksheet.
2 Easy Ways to Recover Excel File Password
In this article, we focus on the file encryption with Protect Sheet and demonstrate VBA Macro to recover encrypted file passwords. If users open the password-protected sheet, Excel displays a disclaimer, stating the file is a protected file and the user needs to input a password to edit or modify as depicted in the below image.
Follow the latter section to retrieve or remove an Excel file password.
🔄 VBA Macro Code to Recover Excel File Password
We can recover the forgotten Excel file password using a VBA Macro code. The code tries iterations of probable passwords and in the end, breaks file protection by generating a workable password to unprotect the worksheet.
🔺 Ensure the encrypted file is saved in the prior versions of 2010 Excel (i.e., Excel 97-2003 Workbook(*xls)) as shown in the following picture.
Step 1: Use ALT+F11 or go to the Developer tab > Click on Visual Basic (in the Code section). The Microsoft Visual Basic window opens. Select Insert > Click on Module.
Step 2: Paste the following macro in the Module.
Sub RecoverExcelFilePassword()
Dim u As Integer, v As Integer, w As Integer
Dim x As Integer, y As Integer, z As Integer
Dim u1 As Integer, u2 As Integer, u3 As Integer
Dim u4 As Integer, u5 As Integer, u6 As Integer
On Error Resume Next
For u = 65 To 66: For v = 65 To 66: For w = 65 To 66
For x = 65 To 66: For y = 65 To 66: For u1 = 65 To 66
For u2 = 65 To 66: For u3 = 65 To 66: For u4 = 65 To 66
For u5 = 65 To 66: For u6 = 65 To 66: For z = 32 To 126
ActiveSheet.Unprotect Chr(u) & Chr(v) & Chr(w) & _
Chr(x) & Chr(y) & Chr(u1) & Chr(u2) & Chr(u3) & _
Chr(u4) & Chr(u5) & Chr(u6) & Chr(z)
If ActiveSheet.ProtectContents = False Then
MsgBox "Can use this Password: " & Chr(u) & Chr(v) & _
Chr(w) & Chr(x) & Chr(y) & Chr(u1) & Chr(u2) & _
Chr(u3) & Chr(u4) & Chr(u5) & Chr(u6) & Chr(z)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub
The macro generates iterations of probable passwords and uses them to break the protection.
Afterward, press the F5 key to run the macro. The macro takes quite some time to finish and returns an alternative password to unprotect the Worksheet.
⧭ Warning: Executing the macro may return freezing or hanging your device. So, if you are doing other work on your device you shouldn’t run the macro in that case.
Read More: How to Recover Previous Version of Excel File (4 Easy Ways)
Similar Readings
- How to Recover a Deleted Excel File (5 Effective Ways)
- [Fixed:] Unsaved Excel File Not in Recovery
- How to Recover Excel File Password (2 Easy Ways)
- How to Recover Overwritten Excel File with No Previous Version
🔄 Removing Excel File Password Using Zip Tool
By editing a zip xml file, we can remove the file protection portion of an encrypted file. To do so, perform the below steps.
Step 1: In the device directory, Select the encrypted file, and go to View > Tick File name extensions. File Explorer will show the selected file types (i.e., xlsx).
Step 2: Modify the File Extension to zip from xlsx.
Step 3: The device system will fetch a confirmation window, click on Yes.
Step 4: The file gets converted into a zip file. Double click on it.
Step 5: Inside the zip file, there is a file named xl. Double click on it.
Step 6: The xl file holds the protected sheet or sheets. In this case, sheet1.xml is the zipped version of the encrypted Excel file. Copy the file to Desktop or any location.
Step 7: Open the File using Notepad.
Step 8: Use CTRL+F to bring out the Find window. Type protect then Click on Find Next in the window. Notepad highlights the “protect” text within the file text.
Step 9: Delete the entire <sheetProtect…..SelectUnlockedCells=”1”/> portion from file text.
Step 10: Now, save the file Text using File > Save.
Step 11: Afterward Copy and Replace the newly saved sheet1.xml file with the zipped file’s version of it.
Step 12: Change the file types by changing the File Extension from zip to xlsx.
🔼 In the end, open the modified xlsx file and you see you can edit this version of the file.
After being able to access the file, you can execute password protection for the file or worksheets again.
Read More: How to Recover Corrupted Excel File (8 Possible Ways)
Conclusion
In this article, we demonstrate ways to recover or remove Excel file password. Hope these methods do their job in your case. Comment, if you have further inquiries or have anything to add.
Related Articles
- How to Backup Excel Files to a Flash Drive (4 Useful Methods)
- Undo Changes in Excel after Save and Close (2 Easy Methods)
- How to Auto Backup Excel File (2 Easy Methods)
- Recover Corrupted Excel Files from USB (4 Quick Methods)
- How to Recover File after Crash in Excel (4 Methods)
- How to Find Backup Files in Excel (5 Easy Methods)