监理检测网论坛

注册

 

发新话题 回复该主题

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

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

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

ìfFSgê ¯bbs.3c3t.comÑ¡㠐”i€ÿ
我在黄河上
TOP
3#

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

???ìfFSgê ¯bbs.3c3t.comÑ¡㠐”i€ÿ
TOP
4#

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

ìfFSgê ¯bbs.3c3t.comÑ¡㠐”i€ÿ
TOP
5#

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

谢谢了ìfFSgê ¯bbs.3c3t.comÑ¡㠐”i€ÿ
TOP
发主话题 回复该主题