监理检测网论坛

注册

 

发新话题 回复该主题

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

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

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

lÐg¶'Y ›bbs.3c3t.comf3è¶7)î9®
我在黄河上
TOP
3#

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

???lÐg¶'Y ›bbs.3c3t.comf3è¶7)î9®
TOP
4#

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

lÐg¶'Y ›bbs.3c3t.comf3è¶7)î9®
TOP
5#

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

谢谢了lÐg¶'Y ›bbs.3c3t.comf3è¶7)î9®
TOP
发主话题 回复该主题