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