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