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