Excel工作表保护密码破解方法:íEË»Ð%k ÷bbs.3c3t.comI£_!G
1\打开文件íEË»Ð%k ÷bbs.3c3t.comI£_!G
2\工具---宏----录制新宏---输入名字如:aaíEË»Ð%k ÷bbs.3c3t.comI£_!G
3\停止录制(这样得到一个空宏)íEË»Ð%k ÷bbs.3c3t.comI£_!G
4\工具---宏----宏,选aa,点编辑按钮íEË»Ð%k ÷bbs.3c3t.comI£_!G
5\删除窗口中的所有字符(只有几个),替换为下面的内容:(复制吧)íEË»Ð%k ÷bbs.3c3t.comI£_!G
6\关闭编辑窗口íEË»Ð%k ÷bbs.3c3t.comI£_!G
7\工具---宏-----宏,选AllInternalPasswords,运行,确定两次,等2分钟,再确定.OK,没有密码了!!内容如下:Public Sub AllInternalPasswords() íEË»Ð%k ÷bbs.3c3t.comI£_!G
' Breaks worksheet and workbook structure passwords. Bob McCormick íEË»Ð%k ÷bbs.3c3t.comI£_!G
' probably originator of base code algorithm modified for coverage íEË»Ð%k ÷bbs.3c3t.comI£_!G
' of workbook structure / windows passwords and for multiple passwords íEË»Ð%k ÷bbs.3c3t.comI£_!G
' íEË»Ð%k ÷bbs.3c3t.comI£_!G
' Norman Harker and JE McGimpsey 27-Dec-2002 (Version 1.1) íEË»Ð%k ÷bbs.3c3t.comI£_!G
' Modified 2003-Apr-04 by JEM: All msgs to constants, and íEË»Ð%k ÷bbs.3c3t.comI£_!G
' eliminate one Exit Sub (Version 1.1.1) íEË»Ð%k ÷bbs.3c3t.comI£_!G
' Reveals hashed passwords NOT original passwords íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const DBLSPACE As String = vbNewLine & vbNewLine íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const AUTHORS As String = DBLSPACE & vbNewLine & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"Adapted from Bob McCormick base code by" & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"Norman Harker and JE McGimpsey" íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const HEADER As String = "AllInternalPasswords User Message" íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const VERSION As String = DBLSPACE & "Version 1.1.1 2003-Apr-04" íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const REPBACK As String = DBLSPACE & "Please report failure " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"to the microsoft.public.excel.programming newsgroup." íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const ALLCLEAR As String = DBLSPACE & "The workbook should " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"now be free of all password protection, so make sure you:" & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
DBLSPACE & "SAVE IT NOW!" & DBLSPACE & "and also" & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
DBLSPACE & "BACKUP!, BACKUP!!, BACKUP!!!" & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
DBLSPACE & "Also, remember that the password was " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"put there for a reason. Don't stuff up crucial formulas " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"or data." & DBLSPACE & "Access and use of some data " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"may be an offense. If in doubt, don't." íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const MSGNOPWORDS1 As String = "There were no passwords on " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"sheets, or workbook structure or windows." & AUTHORS & VERSION íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const MSGNOPWORDS2 As String = "There was no protection to " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"workbook structure or windows." & DBLSPACE & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"Proceeding to unprotect sheets." & AUTHORS & VERSION íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const MSGTAKETIME As String = "After pressing OK button this " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"will take some time." & DBLSPACE & "Amount of time " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"depends on how many different passwords, the " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"passwords, and your computer's specification." & DBLSPACE & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"Just be patient! Make me a coffee!" & AUTHORS & VERSION íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const MSGPWORDFOUND1 As String = "You had a Worksheet " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"Structure or Windows Password set." & DBLSPACE & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"The password found was: " & DBLSPACE & "$$" & DBLSPACE & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"Note it down for potential future use in other workbooks by " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"the same person who set this password." & DBLSPACE & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"Now to check and clear other passwords." & AUTHORS & VERSION íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const MSGPWORDFOUND2 As String = "You had a Worksheet " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"password set." & DBLSPACE & "The password found was: " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
DBLSPACE & "$$" & DBLSPACE & "Note it down for potential " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"future use in other workbooks by same person who " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"set this password." & DBLSPACE & "Now to check and clear " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"other passwords." & AUTHORS & VERSION íEË»Ð%k ÷bbs.3c3t.comI£_!G
Const MSGONLYONE As String = "Only structure / windows " & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"protected with the password that was just found." & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
ALLCLEAR & AUTHORS & VERSION & REPBACK íEË»Ð%k ÷bbs.3c3t.comI£_!G
Dim w1 As Worksheet, w2 As Worksheet íEË»Ð%k ÷bbs.3c3t.comI£_!G
Dim i As Integer, j As Integer, k As Integer, l As Integer íEË»Ð%k ÷bbs.3c3t.comI£_!G
Dim m As Integer, n As Integer, i1 As Integer, i2 As Integer íEË»Ð%k ÷bbs.3c3t.comI£_!G
Dim i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer íEË»Ð%k ÷bbs.3c3t.comI£_!G
Dim PWord1 As String íEË»Ð%k ÷bbs.3c3t.comI£_!G
Dim ShTag As Boolean, WinTag As Boolean íEË»Ð%k ÷bbs.3c3t.comI£_!G
Application.ScreenUpdating = False íEË»Ð%k ÷bbs.3c3t.comI£_!G
With ActiveWorkbook íEË»Ð%k ÷bbs.3c3t.comI£_!G
WinTag = .ProtectStructure Or .ProtectWindows íEË»Ð%k ÷bbs.3c3t.comI£_!G
End With íEË»Ð%k ÷bbs.3c3t.comI£_!G
ShTag = False íEË»Ð%k ÷bbs.3c3t.comI£_!G
For Each w1 In Worksheets íEË»Ð%k ÷bbs.3c3t.comI£_!G
ShTag = ShTag Or w1.ProtectContents íEË»Ð%k ÷bbs.3c3t.comI£_!G
Next w1 íEË»Ð%k ÷bbs.3c3t.comI£_!G
If Not ShTag And Not WinTag Then íEË»Ð%k ÷bbs.3c3t.comI£_!G
MsgBox MSGNOPWORDS1, vbInformation, HEADER íEË»Ð%k ÷bbs.3c3t.comI£_!G
Exit Sub íEË»Ð%k ÷bbs.3c3t.comI£_!G
End If íEË»Ð%k ÷bbs.3c3t.comI£_!G
MsgBox MSGTAKETIME, vbInformation, HEADER íEË»Ð%k ÷bbs.3c3t.comI£_!G
If Not WinTag Then íEË»Ð%k ÷bbs.3c3t.comI£_!G
MsgBox MSGNOPWORDS2, vbInformation, HEADER íEË»Ð%k ÷bbs.3c3t.comI£_!G
Else íEË»Ð%k ÷bbs.3c3t.comI£_!G
On Error Resume Next íEË»Ð%k ÷bbs.3c3t.comI£_!G
Do 'dummy do loop íEË»Ð%k ÷bbs.3c3t.comI£_!G
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 íEË»Ð%k ÷bbs.3c3t.comI£_!G
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 íEË»Ð%k ÷bbs.3c3t.comI£_!G
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66 íEË»Ð%k ÷bbs.3c3t.comI£_!G
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126 íEË»Ð%k ÷bbs.3c3t.comI£_!G
With ActiveWorkbook íEË»Ð%k ÷bbs.3c3t.comI£_!G
.Unprotect Chr(i) & Chr(j) & Chr(k) & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) íEË»Ð%k ÷bbs.3c3t.comI£_!G
If .ProtectStructure = False And _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
.ProtectWindows = False Then íEË»Ð%k ÷bbs.3c3t.comI£_!G
PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) íEË»Ð%k ÷bbs.3c3t.comI£_!G
MsgBox Application.Substitute(MSGPWORDFOUND1, _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"$$", PWord1), vbInformation, HEADER íEË»Ð%k ÷bbs.3c3t.comI£_!G
Exit Do 'Bypass all for...nexts íEË»Ð%k ÷bbs.3c3t.comI£_!G
End If íEË»Ð%k ÷bbs.3c3t.comI£_!G
End With íEË»Ð%k ÷bbs.3c3t.comI£_!G
Next: Next: Next: Next: Next: Next íEË»Ð%k ÷bbs.3c3t.comI£_!G
Next: Next: Next: Next: Next: Next íEË»Ð%k ÷bbs.3c3t.comI£_!G
Loop Until True íEË»Ð%k ÷bbs.3c3t.comI£_!G
On Error GoTo 0 íEË»Ð%k ÷bbs.3c3t.comI£_!G
End If íEË»Ð%k ÷bbs.3c3t.comI£_!G
If WinTag And Not ShTag Then íEË»Ð%k ÷bbs.3c3t.comI£_!G
MsgBox MSGONLYONE, vbInformation, HEADER íEË»Ð%k ÷bbs.3c3t.comI£_!G
Exit Sub íEË»Ð%k ÷bbs.3c3t.comI£_!G
End If íEË»Ð%k ÷bbs.3c3t.comI£_!G
On Error Resume Next íEË»Ð%k ÷bbs.3c3t.comI£_!G
For Each w1 In Worksheets íEË»Ð%k ÷bbs.3c3t.comI£_!G
'Attempt clearance with PWord1 íEË»Ð%k ÷bbs.3c3t.comI£_!G
w1.Unprotect PWord1 íEË»Ð%k ÷bbs.3c3t.comI£_!G
Next w1 íEË»Ð%k ÷bbs.3c3t.comI£_!G
On Error GoTo 0 íEË»Ð%k ÷bbs.3c3t.comI£_!G
ShTag = False íEË»Ð%k ÷bbs.3c3t.comI£_!G
For Each w1 In Worksheets íEË»Ð%k ÷bbs.3c3t.comI£_!G
'Checks for all clear ShTag triggered to 1 if not. íEË»Ð%k ÷bbs.3c3t.comI£_!G
ShTag = ShTag Or w1.ProtectContents íEË»Ð%k ÷bbs.3c3t.comI£_!G
Next w1 íEË»Ð%k ÷bbs.3c3t.comI£_!G
If ShTag Then íEË»Ð%k ÷bbs.3c3t.comI£_!G
For Each w1 In Worksheets íEË»Ð%k ÷bbs.3c3t.comI£_!G
With w1 íEË»Ð%k ÷bbs.3c3t.comI£_!G
If .ProtectContents Then íEË»Ð%k ÷bbs.3c3t.comI£_!G
On Error Resume Next íEË»Ð%k ÷bbs.3c3t.comI£_!G
Do 'Dummy do loop íEË»Ð%k ÷bbs.3c3t.comI£_!G
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 íEË»Ð%k ÷bbs.3c3t.comI£_!G
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 íEË»Ð%k ÷bbs.3c3t.comI£_!G
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66 íEË»Ð%k ÷bbs.3c3t.comI£_!G
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126 íEË»Ð%k ÷bbs.3c3t.comI£_!G
.Unprotect Chr(i) & Chr(j) & Chr(k) & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) íEË»Ð%k ÷bbs.3c3t.comI£_!G
If Not .ProtectContents Then íEË»Ð%k ÷bbs.3c3t.comI£_!G
PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) íEË»Ð%k ÷bbs.3c3t.comI£_!G
MsgBox Application.Substitute(MSGPWORDFOUND2, _ íEË»Ð%k ÷bbs.3c3t.comI£_!G
"$$", PWord1), vbInformation, HEADER íEË»Ð%k ÷bbs.3c3t.comI£_!G
'leverage finding Pword by trying on other sheets íEË»Ð%k ÷bbs.3c3t.comI£_!G
For Each w2 In Worksheets íEË»Ð%k ÷bbs.3c3t.comI£_!G
w2.Unprotect PWord1 íEË»Ð%k ÷bbs.3c3t.comI£_!G
Next w2 íEË»Ð%k ÷bbs.3c3t.comI£_!G
Exit Do 'Bypass all for...nexts íEË»Ð%k ÷bbs.3c3t.comI£_!G
End If íEË»Ð%k ÷bbs.3c3t.comI£_!G
Next: Next: Next: Next: Next: Next íEË»Ð%k ÷bbs.3c3t.comI£_!G
Next: Next: Next: Next: Next: Next íEË»Ð%k ÷bbs.3c3t.comI£_!G
Loop Until True íEË»Ð%k ÷bbs.3c3t.comI£_!G
On Error GoTo 0 íEË»Ð%k ÷bbs.3c3t.comI£_!G
End If íEË»Ð%k ÷bbs.3c3t.comI£_!G
End With íEË»Ð%k ÷bbs.3c3t.comI£_!G
Next w1 íEË»Ð%k ÷bbs.3c3t.comI£_!G
End If íEË»Ð%k ÷bbs.3c3t.comI£_!G
MsgBox ALLCLEAR & AUTHORS & VERSION & REPBACK, vbInformation, HEADER íEË»Ð%k ÷bbs.3c3t.comI£_!G
End SubíEË»Ð%k ÷bbs.3c3t.comI£_!G