1、Excel 密码保护的解除方法与解除原理:AAAABBBBAAA7Excel 弹出“您试图更改的单元格或图表受保护,因而是只读的。若要修改受保护单元格或图表,请先使用撤消工作表保护命令(在审阅选项卡的更改组中)来取消保护。可能会提示您输入密码。”窗口,如图 1。 出现这种情况,应该怎么解决呢?经过研究,找到了两种破解 Excel 工作表保护码的方法。一、VBA 宏代码破解法:第一步:打开该文件,先解除默认的“宏禁用”状态,方法是点击工具栏下的“选项”状态按钮,打开“MicrosoftOffice 安全选项”窗口,选择其中的“启用此内容”,“确定”退出(图 2);再切换到“视图”选项卡,点击“宏
2、”“录制宏”,出现“录制新宏”窗口,在“宏名”定义一个名称为:PasswordBreaker(图 3),点击“确定”退出;第二步:再点击“宏”“查看宏”,选择“宏名”下的“PasswordBreaker”并点击“编辑”,打开“MicrosoftVisualBasic”编辑器,用如下内容替换右侧窗口中的所有代码:Sub PasswordBreaker()Dim i As Integer, j As Integer, k As IntegerDim l As Integer, m As Integer, n As IntegerDim i1 As Integer, i2 As Integer, i
3、3 As IntegerDim i4 As Integer, i5 As Integer, i6 As IntegerOn Error Resume NextFor 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 126Active
4、Sheet.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 ActiveSheet.ProtectContents = False ThenMsgBox “One usable password is “ & Chr(i)& Chr(j) & _Chr(k) & Chr(l) & Chr(m)& Chr(i1) & Chr(i2)& _Chr(i3) & Chr(i4) & Chr(i5)& Chr(
5、i6) & Chr(n)ActiveWorkbook.Sheets(1).SelectRange(“a1“).FormulaR1C1 = Chr(i) & Chr(j)& _Chr(k) & Chr(l) & Chr(m)& Chr(i1) & Chr(i2)& _Chr(i3) & Chr(i4) & Chr(i5)& Chr(i6) & Chr(n)Exit SubEnd IfNext: Next: Next: Next: Next: NextNext: Next: Next: Next: Next: NextEnd Sub第三步:再点击“宏”“查看宏”,选择“宏名”下的“Password
6、Breaker”并点击“执行”,密码就现形了(图 4)。第四步:切换“审阅”选项卡,点击“撤消工作表保护”,然后输入密码即可解除锁定。二、软件破解法有许多专门为破解 Excel 各种密码而制作的软件,ExcelKey 与 Advanced Office PasswordRecovery 就是其中的佼佼者。它们的使用方法简单且破解速度极快。1. Excel Key下载(下载地址:http:/ 5)。2. Advanced Office Password Recovery下载(下载地址:http:/ Excel 文件,马上就可以看到解出的密码了(图 6)。可以看出,用以上方法读出的密码完全不同,但
7、它们确实均可以解除该工作表的密码保护,这实在是个有趣的问题。在网上查找了许久,终于找到比较圆满的解释答案:当 Excel 工作表采用密码保护时,就会生成一个 16 位(双字节)长 hash 值。当输入密码进行验证时,真正进行比较的就是这个 hash 值。事实上,有很多不同的密码都可以生成同样的 hash 值。大家可以试试:当你用“test”(不含双引号)作为 Excel 工作表保护密码,你同样可以用“zzyw”(同样不含双引号)这个密码进行解锁。怎么样,神奇吧?Excel 对数据有很强的保护功能,可以对整个或部分数据隐藏、禁止复制和修改等,但有时候,由于忘记了密码,或者记不起以前自己到底做了哪
8、些改动,这种保护反而会为难自己。针对这种情况,我总结了几种解除保护的方法,供大家参考,并希望能够以此抛砖引玉。 一、解除单元格的保护1取消隐藏的行或列 被隐藏的行或列有一个明显的标志,那就是在行标题栏或列标题栏上有一条粗的黑线。取消隐藏的行或列的方法有两种,一种是直接拖动隐藏处的行或列标题使之变宽,也可以选中包含隐藏区域的行或列,通过“格式”菜单中的行列项目输入非 0 数值调整行高或列宽,使数据有足够的空间显示出来;另一种方法是选中包含隐藏内容的行或列区域,再通过“格式”菜单行列选项中的“取消隐藏”命令来恢复全部行列区域。2取消隐藏单元格或区域中的数据为了不让他人直接看到单元格的内容,一种简单
9、的方法就是把数据颜色设置成与背景色相同,这时我们只要拖选整个工作表即可让数据原形毕露;如果用图片、矩形框之类的非字符内容将重要数据遮盖,需要先用拖选方式找出工作表中的图片位置,再将其移开,激活被遮住的单元格,一般在公式编辑栏中就会显示其内容。若在单元格格式中使用了三个分号或空格之类的自定义格式,一般只要选中此单元格,在公式编辑栏中即可显示其内容,要想取消这种隐藏,可重新设置此单元格格式,在“数字”选项卡中选择“常规”即可。如果选中怀疑有数据的单元格后并没有在公式编辑栏中显示数据,不一定它就真的没有数据,我们只要看一下单元格的格式能否设置,若不能的话说明工作表被保护,如果不用密码可以取消工作表保
10、护的话,再在单元格格式设置中先查看数据格式是否为自定义,然后查看“保护”选项卡,看看是否已勾选了“隐藏”项,将这些都取消就可以知道单元格是否真的没有内容。当然,如果在撤消工作表保护时需要密码的话,我们将无可奈何,除非用户设置的密码很简单,那我就告诉你一个秘密,当密码的形式是“*123*”或“*abc*”时,我们可以分别用“*333*”或“*ccc*”来破解,星号表示任意字符,到底是什么只有靠猜了,这种方法对工作表和工作簿保护的密码也适应。3取消单元格数据的只读属性有时单元格中的数据虽然可见,但是我们既不能修改,也不能在当前工作表中复制,对于这种保护措施,取消的方法跟上面的第 2 点基本相同,只
11、要取消单元格格式设置对话框中“保护”选项卡中的“锁定”一项即可。当然还需要通过密码取消工作表的保护才行。 如果我们无法通过密码取消怎么办?你可以将其复制粘贴到其他工作表中,再在新的工作表中进行修改。二、解除工作表的保护查看是否有被隐藏的工作表,若菜单中有“格式工作表取消隐藏”项,则可通过此项取消隐藏的工作表。如果在菜单中也没有有效的“取消隐藏”项,仍然可能有被隐藏的工作表,这时我们可以任选一工作表右击,在弹出菜单中选择“查看代码”,然后在左窗格中的“Microsoft Excel 对象”列表中选择被隐藏的工作表,将其“Visible”属性值取“-1”退出即可,如图所示。如果工作表被密码保护,则
12、可复制当前表全部内容到另一张未保护的工作表中编辑。三、VBA 宏代码破解法:第一步:打开该文件,先解除默认的“宏禁用”状态,方法是点击工具栏下的“选项”状态按钮,打开“Microsoft Office 安全选项”窗口,选择其中的“启用此内容”,“确定”退出(图 2);再切换到“视图”选项卡,点击“宏”“录制宏”,出现“录制新宏”窗口,在“宏名”定义一个名称为:PasswordBreaker(图 3),点击“确定”退出;第二步:再点击“宏”“查看宏”,选择“宏名”下的“PasswordBreaker”并点击“编辑”,打开“Microsoft Visual Basic”编辑器,用如下内容替换右侧窗
13、口中的所有代码:Sub PasswordBreaker()Dim i As Integer, j As Integer, k As IntegerDim l As Integer, m As Integer, n As IntegerDim i1 As Integer, i2 As Integer, i3 As IntegerDim i4 As Integer, i5 As Integer, i6 As IntegerOn Error Resume NextFor i = 65 To 66: For j = 65 To 66: For k = 65 To 66For l = 65 To 66:
14、 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 126ActiveSheet.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 ActiveSheet.Prot
15、ectContents = False ThenMsgBox “One usable password is “ & Chr(i) & Chr(j) & _Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)ActiveWorkbook.Sheets(1).SelectRange(“a1“).FormulaR1C1 = Chr(i) & Chr(j) & _Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _Chr(
16、i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)Exit SubEnd IfNext: Next: Next: Next: Next: NextNext: Next: Next: Next: Next: NextEnd Sub第三步:再点击“宏”“查看宏”,选择“宏名”下的“PasswordBreaker”并点击“执行”,密码就现形了(图 4)。第四步:切换“审阅”选项卡,点击“撤消工作表保护”,然后输入密码即可解除锁定。另一个能解除 Excel 工作表保护的 VBA 脚本Option Explicit Public Sub AllInternalPassw
17、ords() 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-2002 (Version 1.1) Modified 2003-Apr-04 by JEM: All msgs
18、 to constants, and eliminate one Exit Sub (Version 1.1.1) Reveals hashed passwords NOT original passwords Const DBLSPACE As String = vbNewLine & vbNewLine Const AUTHORS As String = DBLSPACE & vbNewLine & _ “Adapted from Bob McCormick base code by“ & _ “Norman Harker and JE McGimpsey“ Const HEADER As
19、 String = “AllInternalPasswords User Message“ Const VERSION As String = DBLSPACE & “Version 1.1.1 2003-Apr-04“ Const REPBACK As String = DBLSPACE & “Please report failure “ & _ “to the microsoft.public.excel.programming newsgroup.“ Const ALLCLEAR As String = DBLSPACE & “The workbook should “ & _ “no
20、w 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 & “
21、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 & VERSION Const MSGNOPWORDS2 As String = “There was no protection to “ & _ “workbook structure or windows.“
22、 & DBLSPACE & _ “Proceeding to unprotect sheets.“ & AUTHORS & VERSION Const 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.“ & DBLS
23、PACE & _ “Just be patient! Make me a coffee!“ & AUTHORS & VERSION Const 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 “
24、& _ “the same person who set this password.“ & DBLSPACE & _ “Now to check and clear other passwords.“ & AUTHORS & VERSION Const MSGPWORDFOUND2 As String = “You had a Worksheet “ & _ “password set.“ & DBLSPACE & “The password found was: “ & _ DBLSPACE & “$“ & DBLSPACE & “Note it down for potential “
25、& _ “future use in other workbooks by same person who “ & _ “set this password.“ & DBLSPACE & “Now to check and clear “ & _ “other passwords.“ & AUTHORS & VERSION Const MSGONLYONE As String = “Only structure / windows “ & _ “protected with the password that was just found.“ & _ ALLCLEAR & AUTHORS &
26、VERSION & REPBACK Dim w1 As Worksheet, w2 As Worksheet Dim i As Integer, j As Integer, k As Integer, l As Integer Dim m As Integer, n As Integer, i1 As Integer, i2 As Integer Dim i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer Dim PWord1 As String Dim ShTag As Boolean, WinTag As Boolean A
27、pplication.ScreenUpdating = False With ActiveWorkbook WinTag = .ProtectStructure Or .ProtectWindows End With ShTag = False For Each w1 In Worksheets ShTag = ShTag Or w1.ProtectContents Next w1 If Not ShTag And Not WinTag Then MsgBox MSGNOPWORDS1, vbInformation, HEADER Exit Sub End If MsgBox MSGTAKET
28、IME, vbInformation, HEADER If Not WinTag Then MsgBox MSGNOPWORDS2, vbInformation, HEADER Else On Error Resume Next Do dummy do loop For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66 For i
29、5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126 With 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 Then PWord1 = Chr(i) & Chr(j) & Chr(k) & Ch
30、r(l) & _ Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) MsgBox Application.Substitute(MSGPWORDFOUND1, _ “$“, PWord1), vbInformation, HEADER Exit Do Bypass all for.nexts End If End With Next: Next: Next: Next: Next: Next Next: Next: Next: Next: Next: Next Loop Until Tru
31、e On Error GoTo 0 End If If WinTag And Not ShTag Then MsgBox MSGONLYONE, vbInformation, HEADER Exit Sub End If On Error Resume Next For Each w1 In Worksheets Attempt clearance with PWord1 w1.Unprotect PWord1 Next w1 On Error GoTo 0 ShTag = False For Each w1 In Worksheets Checks for all clear ShTag t
32、riggered to 1 if not. ShTag = ShTag Or w1.ProtectContents Next w1 If ShTag Then For Each w1 In Worksheets With w1 If .ProtectContents Then On Error Resume Next Do Dummy do loop For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 For i2 = 65 To 6
33、6: For i3 = 65 To 66: For i4 = 65 To 66 For 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 Then PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _ C
34、hr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) MsgBox Application.Substitute(MSGPWORDFOUND2, _ “$“, PWord1), vbInformation, HEADER leverage finding Pword by trying on other sheets For Each w2 In Worksheets w2.Unprotect PWord1 Next w2 Exit Do Bypass all for.nexts End If
35、Next: Next: Next: Next: Next: Next Next: Next: Next: Next: Next: Next Loop Until True On Error GoTo 0 End If End With Next w1 End If MsgBox ALLCLEAR & AUTHORS & VERSION & REPBACK, vbInformation, HEADER End Sub - 把上面的代码保存为一个宏,运行,点两次确定,等到它运行结束,工作表密密码就解除了。如果出现提示“工程不可查看”不能录制新宏,可以先使用“VBA 工程加锁解锁器”来解除其“工程不
36、可查看”后再用上面的方法找出保护密码。当然了,“VBA 工程加锁解锁器”顾名思义,这是一个既可以解除Excel 保护密码,又可以为 Excel 加保护密码的软件,实为一个优秀的 Excel 辅助工具。下载地址:http:/ Excel Password Recovery V1.0c 下载地址:http:/ Kit V7.1.1411 汉化版.rar 下载地址 http:/ 相信有了上面这些方法,Excel 中应该没有多少东西能够瞒过你的火眼金睛,也没有多少内容让你不能左右了。破解 excel 保护密码的方法1、打开文件2、工具-宏-录制新宏-输入名字如:aa3、停止录制(这样得到一个空宏)4、
37、工具-宏-宏,选 aa,点编辑按钮5、删除窗口中的所有字符(只有几个),替换为下面的内容:Public 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 M
38、cGimpsey 27-Dec-2002 (Version 1.1) Modified 2003-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 McCormi
39、ck base code by“ & _“Norman Harker and JE McGimpsey“Const HEADER As String = “AllInternalPasswords User Message“Const VERSION As String = DBLSPACE & “Version 1.1.1 2003-Apr-04“Const REPBACK As String = DBLSPACE & “Please report failure “ & _“to the microsoft.public.excel.programming newsgroup.“Const
40、 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
41、 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
42、 protection to “ & _“workbook structure or windows.“ & DBLSPACE & _“Proceeding to unprotect sheets.“ & 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 “ & _“passw
43、ords, 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 pot
44、ential 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 & “$“ & DBLS
45、PACE & “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 f
46、ound.“ & _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 Boo
47、lean, 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 =