VBA代码破解
右键工作表,单击查看代码
然后粘贴以下VBA代码,在点击运行(F5),大功告成!
Sub 密码破解()
ActiveSheet.Protect DrawingObjects:=True, CONTENTS:=True, AllowFiltering:=True
ActiveSheet.Protect DrawingObjects:=False, CONTENTS:=True, AllowFiltering:=True
ActiveSheet.Unprotect
End Sub
其实代码还不止这个
Sub RemoveShProtect()
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
方法二:将文件后缀名修改为RAR压缩文件后打开相关文件将加密代码删除进行破解
1、我们关闭工作簿,将此工作簿重命名修改文件后缀名为“rar”
2、双击打开rar文件,找到'sheet1.xml',文件路径为“xl>>worksheets>>sheet1.xml”,因为身份证验证工作表是第一个工作表,所以选择sheet1.xml,要是第二个工作表加密就选择sheet2.xml,两个都加的话就两个文件都修改。
3、双击'sheet1.xml'并用记事本打开,使用查找功能,删除“sheetProtection”字段(<>尖括号内的内容 )
4、将文件后缀名更改回'xlsx',大功告成!