Open password protected EXCEL file

Donkjam

Professional Moderator
Contributor
Nov 20, 2010
1,608
1,603
So my brother has a EXCEL file that is password protected. The password isn't know therefore was wondering if anyone knows a way of getting into the file?

Thought of bruteforce etc but want an easier way if anyone knows
 

TesoMayn

Boredom, it vexes me.
Oct 30, 2011
1,482
1,482
Found this:
  1. Create backup of password-protected excel file.
  2. Change the file extension to .zip from .xlsx.
  3. Now extract the whole content of zip file.
  4. Search for xml format of targeted sheet. You will find it in ‘xl -> worksheets’ directory.
  5. Open the xml file of targeted sheet in xml editor.
  6. Now search for ‘sheetProtection’ word in that xml file and remove it.
  7. Save this edited xml file and replace it with old xml file in zip files.
  8. Now change the extension from .zip to .xlsx.
And then of course you have a code breaker
Code:
Sub PasswordBreaker()
  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
  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
  ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
    Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
    Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
  If ActiveSheet.ProtectContents = False Then
    MsgBox "One usable password is " & Chr(i) & Chr(j) & _
      Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
      Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
    Exit Sub
  End If
  Next: Next: Next: Next: Next: Next
  Next: Next: Next: Next: Next: Next
End Sub
 

Users who are viewing this thread

Top