つらつら Excel VBA

私の備忘録です。

ブックのパスワード解除

On Error Resume Next

SendKeys "{ESC}"
Dim wb As Workbook
Set wb = Workbooks.Open(fileName:=target_path, Password:="Password")

If ActiveWorkbook.Name = FileName Then
    Debug.Print "開きました。"
End If

On Error GoTo 0
Set wb = Nothing