监理检测网论坛

注册

 

发新话题 回复该主题

删除EXCEL工作表保护密码 [复制链接]

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

回复:删除EXCEL工作表保护密码

íEˈ»Ð%k ÷bbs.3c3t.comI£Ÿ_!G
我在黄河上
TOP
3#

回复:删除EXCEL工作表保护密码

???íEˈ»Ð%k ÷bbs.3c3t.comI£Ÿ_!G
TOP
4#

回复:删除EXCEL工作表保护密码

íEˈ»Ð%k ÷bbs.3c3t.comI£Ÿ_!G
TOP
5#

回复:删除EXCEL工作表保护密码

谢谢了íEˈ»Ð%k ÷bbs.3c3t.comI£Ÿ_!G
TOP
发主话题 回复该主题