MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Worksheet Passwords


Posted by Scarlet Farr on January 30, 2002 10:49 AM

I have a client who has an Workbook that contains 5 worksheets. She has turned on the protection within these worksheets and consequently has applied a password to each. She recalls the password to 4 of the 5 worksheets. Is there a way in 2000 to break that password code so that she can continue work on the sheet?


Posted by Larry on January 30, 2002 11:00 AM

*** Plenty of resources on the web that provide "breaker" add-ins. Just do a search and make it an Add-in

Posted by Bariloche on January 30, 2002 8:29 PM

Scarlett,

Here's some code that will help you out.


Sub PasswordBreaker()

'by Bob McCormick on NG: microsoft.public.excel.misc on 22 May 2001.
'Breaks worksheet password protection.

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)
Application.StatusBar = 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 useable 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)
Application.StatusBar = False
Exit Sub
End If
Next n
Next i6
Next i5
Next i4
Next i3
Next i2
Next i1
Next m
Next l
Next k
Next j
Next i
Application.StatusBar = False
End Sub

Note: This code will not tell you what the password was (except by accident). What it does is exploit the poor encryption algorithm that is used for sheet password protection. Try it and you'll see what I mean.

enjoy

Posted by JACK NECK on January 31, 2002 6:34 AM

JUST SENT YOUR FILE TO ME AND I CRACK IT FREELY.MY EMAIL AD INSIDE