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