这是我编写的一段破解EXCEL工作表密码的程序,不知道是否符合题意,谢谢!
使用方法:
1、打开新文件excle, 按ALT+F11, 双击左侧工程ThisWorkbook表单, 把代码拷贝在右面的窗口里;
2、打开密码保护的工作表,运行该宏程序,即可破解工作表密码
Sub unPsht() '删除工作表密码
Dim i As Byte, j As Byte, k As Byte
Dim l As Byte, m As Byte, n As Byte
Dim i1 As Byte, i2 As Byte, i3 As Byte
Dim i4 As Byte, i5 As Byte, i6 As Byte
On Error Resume Next
If ActiveSheet.ProtectContents = False Then MsgBox "该工作表没有设置密码保护", 32, "提示": Exit Sub
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 "找到一个可用密码" & 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