监理检测网论坛

注册

 

发新话题 回复该主题

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

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

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

ý‹mÈ×Vbbs.3c3t.comýyutM¤ å
我在黄河上
TOP
3#

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

???ý‹mÈ×Vbbs.3c3t.comýyutM¤ å
TOP
4#

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

ý‹mÈ×Vbbs.3c3t.comýyutM¤ å
TOP
5#

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

谢谢了ý‹mÈ×Vbbs.3c3t.comýyutM¤ å
TOP
发主话题 回复该主题