监理检测网论坛

注册

 

发新话题 回复该主题

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

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

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

Ž':B5„¦Šbbs.3c3t.comšC¡ ³ó%ê
我在黄河上
TOP
3#

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

???Ž':B5„¦Šbbs.3c3t.comšC¡ ³ó%ê
TOP
4#

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

Ž':B5„¦Šbbs.3c3t.comšC¡ ³ó%ê
TOP
5#

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

谢谢了Ž':B5„¦Šbbs.3c3t.comšC¡ ³ó%ê
TOP
发主话题 回复该主题