Excel文档保护密码破解方法
1、运行Excel,打开有密码保护的文档;点击工具菜单,选择宏——visual basic编辑器,如下图1:
(图1)
2、如未出现如下图2,点击“工程资源管理器图标”,双击sheet1,出现图3所示的编辑框,将代码复制到编辑框中;
图2(图3)
代码:
Sub PasswordBreaker()
Dim i AsInteger, j As Integer, k As Integer
Dim l AsInteger, m As Integer, n As Integer
Dim i1 AsInteger, i2 As Integer, i3 As Integer
Dim i4 AsInteger, i5 As Integer, i6 As Integer
On ErrorResume Next
For i = 65To 66: For j = 65 To 66: For k = 65 To 66
For l = 65To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.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)
IfActiveSheet.ProtectContents = False Then
MsgBox "Oneusable 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).Select
Range("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)
ExitSub
End If
Next: Next:Next: Next: Next: Next
Next: Next:Next: Next: Next: Next
End Sub
3、点击图4中箭头所指图标,运行宏;
等上几秒或几分,就会出现一个对话框,如图5所示:如果出现公式出错提示,请将代码先粘贴到其他文档中,再复制粘贴即可。
(图5)
现在的密码就被破解了。A1单元格出现密码 需要删除还原。