How to unlock a password protected workbook in Excel 2013

The guide below was provided to us by our good friend The Secret Surveyor. We are not entirely sure how he came by this knowledge or what he uses it for, however we would suggest that you use it honestly and only in circumstances where you have forgotten your own password to a workbook.

The code and process used below is one of the most reliable we have found. It is very straight forward and doesn’t require any prior coding knowledge.

Step 1 – Open VBA

Open the workbook you have ‘forgotten your password to’.

Open up the Marcro Editor Tool. (Shortcut Alt+F11)

Once in VBA open the primary sheet you need access to by double clicking it.

This script will open the entire workbook so it doesn’t matter too much which sheet you select.

This will open the declarations page.

Step 2 – Insert the code

Copy and paste the code below into the general declarations page you have opened.

You should not have to change anything within the script.

———————————————————————–

Sub unlocksh()

Dim i As Integer, j As Integer, k As Integer

Dim l As Integer, m As Integer, n As Integer

Dim i1 As Integer, i2 As Integer, i3 As Integer

Dim i4 As Integer, i5 As Integer, i6 As Integer

Dim pwd As String

On Error Resume Next

For i = 65 To 66: For j = 65 To 66: For k = 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 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126

pwd = Chr(i) & Chr(j) & Chr(k) & _

Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _

Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

ActiveWorkbook.Unprotect pwd

If ActiveWorkbook.ProtectStructure = False Then

MsgBox “One usable password is ” & pwd

ActiveWorkbook.Sheets(1).Select

Range(“a1”).FormulaR1C1 = pwd

Exit Sub

End If

Next: Next: Next

Next: Next: Next

Next: Next: Next

Next: Next: Next

End Sub

———————————————————————–

Step 3 – Run the macro

Once the code is added run the Macro by selecting Run from the menu tab bar at the top of the VBA editor screen or simply press F5.

 

Step 4: Use The Generated Code

The macro will return you to the worksheet you want to unprotect.

An alert style box will appear with a usable code. In the Review menu tab click Unprotect sheet. Enter the generated code as the password and you are done. Your sheet should be unlocked!

You should use this power judiciously and dutifully… only to unlock your own worksheets!

Happy Surveying,

The Secret Surveyor