Search This Blog

Sunday 1 March 2009

Code that will stop your brain to work on excel

The below code can be used to crack the excel worksheet password. It may not give the original password but will provide an alternate password that can be used to unprotect the worksheet.Steps:Open the excel workbook that has the protected sheet in it. Select Alt+F11 to open the Visual Basic Editor. Select Insert->Module and paste the below code into the code window:
Sub Excel_Password_Breaker()'Author unknownDim i As Integer, j As Integer, k As IntegerDim l As Integer, m As Integer, n As IntegerDim i1 As Integer, i2 As Integer, i3 As IntegerDim i4 As Integer, i5 As Integer, i6 As IntegerOn Error Resume NextFor i = 65 To 66: For j = 65 To 66: For k = 65 To 66For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126ActiveSheet.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 ThenMsgBox "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)ActiveWorkbook.Sheets(1).SelectRange("a1").FormulaR1C1 = 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 SubEnd IfNext: Next: Next: Next: Next: NextNext: Next: Next: Next: Next: NextEnd SubClose the VB Editor and go to the worksheet you want to unprotect and press Alt+f8 and double click the Excel_Password_Breaker in the list.

coder: Smith solace

special note: just if you dont understand copy it and paste in to the notepad it wil be in propermannner sattled so you can read it.

The following tutorial shows how to protect/unprotect the excel sheet using macroYou have to pass the excel sheet name to the following functions to protect/unprotect the sheetCode to fetch the sheet name:
ThisWorkbook.ActiveSheet.NameCode to unprotect sheet


Public Sub Unprotect_Sheet(sname)Sheets(sname).Unprotect Password:="password"End

SubCode to protect sheet

Public Sub Protect_Sheet(sname)Sheets(sname).Protect Password:="password"End Sub

No comments:

Post a Comment