监理检测网论坛

注册

 

发新话题 回复该主题

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

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

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

A«Õõ9<ß!qbbs.3c3t.comÇß¡ÍKHZ|
我在黄河上
TOP
3#

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

???A«Õõ9<ß!qbbs.3c3t.comÇß¡ÍKHZ|
TOP
4#

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

A«Õõ9<ß!qbbs.3c3t.comÇß¡ÍKHZ|
TOP
5#

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

谢谢了A«Õõ9<ß!qbbs.3c3t.comÇß¡ÍKHZ|
TOP
发主话题 回复该主题