首页 > 编程知识 正文

vba破解excel加密文件,vba 破解密码

时间:2023-05-05 08:40:32 阅读:213187 作者:3434

'1、工作表无法编辑,撤销保护
Sub sheet_unprotect()
ActiveSheet.Protect AllowFiltering:=True
ActiveSheet.Unprotect
End Sub


'2、工作簿结构无法更改,撤销保护(已测试成功)

Sub sheet_visible()
ActiveWorkbook.Sheets.Copy
For Each sh In ActiveWorkbook.Sheets
sh.Visible = True
Next
End Sub

'3、工作表加密,打开需要密码,破解
'先只读打开

Sub crack()
Dim i As Long
Dim FileName As String
Application.ScreenUpdating = False
i = 1
FileName = Application.GetOpenFilename("Excel 文件(*.xls & *.xlsx),*.xls;*.xlsx", , "VBA破解")
FileName = Right(FileName, Len(FileName) - InStrRev(FileName, ""))
line2:
On eror GoTo line1
Do While True
Workbooks.Open FileName, , , , i
MsgBox "password is " & i
Exit Sub
Loop
line1:
i = i + 1
Resume line2
Application.ScreenUpdating = True

End Sub
 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。