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