excel密码忘记了怎么办(office 2007)

2020-09-11 综合 73阅读
如果Excel文件的打开密码忘记了,且密码是7位数以内的数字,可用以下步骤解开:
新开一Excel,同时按Alt和F11,进入VBA界面,点菜单上的插入,模块,在新出来的窗口粘贴一下代码:
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 Error 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然后直接在此界面下按F5运行此宏如果有字母,稍微复杂些,道理是类似的。太长的密码,基本解不开了。若果还有读写密码,且与打开密码一样,将Workbooks.Open FileName, , , , i 改为Workbooks.Open FileName, , , , i, i
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com