|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
用 SendKeys 试试:
- Public Sub UnprotectVBAProject()
- On Error GoTo ErrHandler
- Const conPW As String = "VBAPassword" '改为实际已知的VBA工程密码
- Call SendKeys("%{F11}", True)
- Call SendKeys("%(V)P", True)
- Call SendKeys("{PGUP 5}", True)
- Call SendKeys("{ENTER}" & conPW & "{ENTER}", True)
- ExitProcedure:
- Exit Sub
- ErrHandler:
- Select Case Err.Number
- Case Else
- Application.ScreenUpdating = True
- MsgBox Err.Number & vbNewLine & Err.Description, vbCritical
- Resume ExitProcedure
- Resume
- End Select
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|