ray88’s diary

お仕事で困ったとき用の自分用の覚書

Excel VBA ファイルが既に開かれているかどうか調べる その②

Sub IsBookOpend()
    On Error Resume Next
    Open "C:\Book1.xls" For Append As #1
    Close #1
    If Err.Number > 0 Then
        MsgBox "すでに開かれています"
    Else
        MsgBox "ブックは開かれていません"
    End If
End Sub