Sub 撤消工作表密码保护的宏代码()
Dim wks As Worksheet
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim o As Integer, p As Integer, q As Integer
Dim r As Integer, s As Integer, t As Integer
On Error Resume Next
For Each wks In Worksheets
with wks
If .ProtectContents Then
Do
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 n = 65 To 66
For o = 65 To 66: For p = 65 To 66: For q = 65 To 66
For r = 65 To 66: For s = 65 To 66: For t = 32 To 126
.Unprotect Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(n) & _
Chr(o) & Chr(p) & Chr(q) & Chr(r) & Chr(s) & Chr(t)
If .ProtectContents = False Then
MsgBox “密码已找到!密码是:” & Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(n) & _
Chr(o) & Chr(p) & Chr(q) & Chr(r) & Chr(s) & Chr(t)
Exit Do
End If
Next: Next: Next: Next: Next: Next: Next: Next: Next: Next: Next: Next
Loop Until True
End If
End With
Next wks
End Sub