忘记设置保护工作表密码,怎么板?
- 点滴记录
- 2021-07-19
- 2952
忘记密码不要怕,用它试试代码如下:Sub RemoveExcelProtect( Dim i1 As Integer, i2 As Integer, i3 As Int...
忘记密码不要怕,用它试试
代码如下:
Sub RemoveExcelProtect()
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
Dim i7 As Integer, i8 As Integer, i9 As Integer
Dim i10 As Integer, i11 As Integer, i12 As Integer
Dim t As String
On Error Resume Next
If ActiveSheet.ProtectContents = False Then
MsgBox "该工作表没有保护密码!"
Exit Sub
End If
t = Timer
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 i7 = 65 To 66: For i8 = 65 To 66: For i9 = 65 To 66
For i10 = 65 To 66: For i11 = 65 To 66: For i12 = 32 To 126
ActiveSheet.Unprotect Chr(i1) & Chr(i2) & Chr(i3) & Chr(i4) & Chr(i5) _
& Chr(i6) & Chr(i7) & Chr(i8) & Chr(i9) & Chr(i10) & Chr(i11) & Chr(i12)
If ActiveSheet.ProtectContents = False Then
MsgBox "解除工作表保护!用时" & Format(Timer - t, "0.00") & "秒"
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub
参考文档:ExcelHome
本文链接:http://zxmcloud.com/?id=45
下一篇:VB 如何添加右键弹出菜单
发表评论