资源预览内容
第1页 / 共35页
第2页 / 共35页
第3页 / 共35页
第4页 / 共35页
第5页 / 共35页
第6页 / 共35页
第7页 / 共35页
第8页 / 共35页
第9页 / 共35页
第10页 / 共35页
亲,该文档总共35页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
ExcelExcel 加密保护解锁加密保护解锁拿到一份 Excel 文件,由于有些内容加了保护,修改不了,于是到网上搜索了一下解密方法,找到一种试了一下有效,有大家吧!1打开文件2工具-宏-录制新宏-输入名字如:aa3停止录制(这样得到一个空宏)4工具-宏-宏,选 aa,点编辑按钮5删除窗口中的所有字符(只有几个),替换为下面的内容你复制吧)Option ExplicitPublic Sub AllInternalPasswords() Breaks worksheet and workbook structure passwords. Bob McCormick probably originator of base code algorithm modified for coverage of workbook structure / windows passwords and for multiple passwords Norman Harker and JE McGimpsey 27-Dec-XX (Version 1.1) Modified XX-Apr-04 by JEM: All msgs to constants, and eliminate one Exit Sub (Version 1.1.1) Reveals hashed passwords NOT original passwordsConst DBLSPACE As String = vbNewLine vbNewLineConst AUTHORS As String = DBLSPACE vbNewLine _Adapted from Bob McCormick base code by _Norman Harker and JE McGimpseyConst HEADER As String = AllInternalPasswords User MessageConst VERSION As String = DBLSPACE Version 1.1.1 XX-Apr-04Const REPBACK As String = DBLSPACE _to the microsoft.public.excel.programming newsgroup.Const ALLCLEAR As String = DBLSPACE The workbook should _now be free of all password protection, so make sure you: _DBLSPACE SAVE IT NOW! DBLSPACE and also _DBLSPACE BACKUP!, BACKUP!, BACKUP! _DBLSPACE Also, remember that the password was _put there for a reason. Dont stuff up crucial formulas _or data. DBLSPACE Access and use of some data _may be an offense. If in doubt, dont.Const MSGNOPWORDS1 As String = There were no passwords on _sheets, or workbook structure or windows. AUTHORS VERSIONConst MSGNOPWORDS2 As String = There was no protection to _workbook structure or windows. DBLSPACE _AUTHORS VERSIONConst MSGTAKETIME As String = After pressing OK button this _will take some time. DBLSPACE Amount of time _depends on how many different passwords, the _passwords, and your computers specification. DBLSPACE _Just be patient! Make me a coffee! AUTHORS VERSIONConst MSGPWORDFOUND1 As String = You had a Worksheet _Structure or Windows Password set. DBLSPACE _The password found was: DBLSPACE $ DBLSPACE _Note it down for potential future use in other workbooks by _the same person who set this password. DBLSPACE _Now to check and clear other passwords. AUTHORS VERSIONConst MSGPWORDFOUND2 As String = You had a Worksheet _password set. DBLSPACE The password found was: _DBLSPACE $ DBLSPACE Note it down for potential _future use in other workbooks by same person who _set this password. DBLSPACE Now to check and clear _other passwords. AUTHORS VERSIONConst MSGONLYONE As String = Only structure / windows _protected with the password that was just found. _ALLCLEAR AUTHORS VERSION REPBACKDim w1 As Worksheet, w2 As WorksheetDim i As Integer, j As Integer, k As Integer, l As IntegerDim m As Integer, n As Integer, i1 As Integer, i2 As IntegerDim i3 As Integer, i4 As Integer, i5 As Integer, i6 As IntegerDim PWord1 As StringDim ShTag As Boolean, WinTag As BooleanApplication.ScreenUpdating = FalseWith ActiveWorkbookWinTag = .ProtectStructure Or .ProtectWindowsEnd WithShTag = FalseFor Each w1 In WorksheetsShTag = ShTag Or w1.ProtectContentsNext w1If Not ShTag And Not WinTag ThenMsgBox MSGNOPWORDS1, vbInformation, HEADERExit SubEnd IfMsgBox MSGTAKETIME, vbInformation, HEADERIf Not WinTag ThenMsgBox MSGNOPWORDS2, vbInformation, HEADERElseOn Error Resume NextDo dummy do loopFor i = 65 To 66: For j = 65 To 66: For k = 65 To 66For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126With ActiveWorkbook.Unprotect Chr(i) Chr(j) Chr(k) _Chr(l) Chr(m) Chr(i1) Chr(i2) _Chr(i3) Chr(i4) Chr(i5) Chr(i6) Chr(n)If .ProtectStructure = False And _.ProtectWindows = False ThenPWord1 = Chr(i) Chr(j) Chr(k) Chr(l) _Chr(m) Chr(i1) Chr(i2) Chr(i3) _Chr(i4) Chr(i5) Chr(i6) Chr(n)MsgBox Application.Substitute(MSGPWORDFOUND1, _$, PWord1), vbInformation, HEADERExit Do Bypass all for.nextsEnd IfEnd WithNext: Next: Next: Next: Next: NextNext: Next: Next: Next: Next: NextLoop Until TrueOn Error GoTo 0End IfIf WinTag And Not ShTag ThenMsgBox MSGONLYONE, vbInformation, HEADERExit SubEnd IfOn Error Resume NextFor Each w1 In WorksheetsAttempt clearance with PWord1w1.Unprotect PWord1Next w1On Error GoTo 0ShTag = FalseFor Each w1 In WorksheetsChecks for all clear ShTag triggered to 1 if not.ShTag = ShTag Or w1.ProtectContentsNext w1If ShTag ThenFor Each w1 In WorksheetsWith w1If .ProtectContents ThenOn Error Resume NextDo Dummy do loopFor i = 65 To 66: For j = 65 To 66: For k = 65 To 66For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126.Unprotect Chr(i) Chr(j) Chr(k) _Chr(l) Chr(m) Chr(i1) Chr(i2) Chr(i3) _Chr(i4) Chr(i5) Chr(i6) Chr(n)If Not .ProtectContents ThenPWord1 = Chr(i) Chr(j) Chr(k) Chr(l) _Chr(m) Chr(i1) Chr(i2) Chr(i3) _Chr(i4)
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号