欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

破解Excel密码保护

程序员文章站 2022-04-30 19:37:01
Excel加密虽然不能防止能打开的人通过复制等操作外泄,但至少也是一防较好的防线。移除Excel 2013的密码保护方法如下:   点击“Office”按...
Excel加密虽然不能防止能打开的人通过复制等操作外泄,但至少也是一防较好的防线。移除Excel 2013的密码保护方法如下:

 

点击“Office”按钮,再选择“另存为”: 

在弹出的“另存为”对话框中,单击左下角的“工具”按钮,选择“常规选项”: 

弹出“常规选项”对话框,可以看到,当然有星号显示密码: 

将这个星号显示的密码清除,再单击“确定”即可: 

Excel文件虽然能打开,能编辑,一些工作簿却因为有了“保护工作表”密码而无法编辑。可以用如下代码进行解除密码保护。

 

Sub PasswordBreaker() 

Dim i As Integer, j As Integer, k As Integer 

Dim l As Integer, m As Integer, n As Integer 

Dim i1 As Integer, i2 As Integer, i3 As Integer 

Dim i4 As Integer, i5 As Integer, i6 As Integer 

On Error Resume Next 

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 i5 = 65 To 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) 

If ActiveSheet.ProtectContents = False Then 

MsgBox "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) 

Exit Sub 

End If 

Next: Next: Next: Next: Next: Next 

Next: Next: Next: Next: Next: Next 

End Sub

 

上述代码在Excel 2013上也是有效的

破解Excel密码保护