September 28, 2021

Binary Blogger

Are you a 1 or a 0? News, Thoughts and Reviews

How To: Crack A Protected Excel Workbook

2 min read

excellockIn Excel you have an option to protect a workbook to prevent it from being overly edited or altered by the users. This allows for the integrity of your data within to remain controlled and intact. However there are cases where you don’t have the password and need to edit the file directly. The reasons could range from the original author set the password then left to the simple fact that you forgot what the password was.

This post will show you how to clear out the password and remove the protection.

NOTE – This does not work if the workbook prompts you for a password immediately when you open it. You need to be able to open the file to do this technique.

Also this post is for intended for files you own and control and not to remove other people’s protections.

Here’s how you do it.

  • Open the Excel file.
  • Hit Alt-F11 to open the VB editor
  • In the editor menu select Insert > Module.
  • Copy and paste this code into the new module window, this code will clear out the password.
    • Sub CrackPassword()

      Dim v1 As Integer, u1 As Integer, w1 As Integer
      Dim v2 As Integer, u2 As Integer, w2 As Integer
      Dim v3 As Integer, u3 As Integer, w3 As Integer
      Dim v4 As Integer, u4 As Integer, w4 As Integer
      On Error Resume Next

      For v1 = 65 To 66: For u1 = 65 To 66: For w1 = 65 To 66
      For v2 = 65 To 66: For u2 = 65 To 66: For w2 = 65 To 66
      For v3 = 65 To 66: For u3 = 65 To 66: For w3 = 65 To 66
      For v4 = 65 To 66: For u4 = 65 To 66: For w4 = 32 To 126

      ThisWorkbook.Unprotect Chr(v1) & Chr(u1) & Chr(w1) & _
      Chr(v2) & Chr(u2) & Chr(v3) & Chr(u3) & Chr(w3) & _
      Chr(v4) & Chr(u4) & Chr(w4) & Chr(w2)

      Next: Next: Next: Next: Next: Next
      Next: Next: Next: Next: Next: Next

      End Sub

  • NOTE – if you want to crack just a single sheet change ThisWorkbook to ActiveSheet in the code.
  • Then in the Menu area hit the Green Play button to run it.
  • Protection removed.

That’s it. You now have an unprotected Excel file.

End of line.

Copyright © All rights reserved. | Newsphere by AF themes.