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