Excelブックのオープン
Public Function OpenBook(filename As String) Dim buf As String Dim book As Workbook Dim openedBook As Workbook buf = Dir(filename) If buf = "" Then Set OpenBook = Nothing Exit Function End If For Each book In Workbooks If book.name = buf Then Set OpenBook = book Exit Function End If Next book Application.ScreenUpdating = False Set OpenBook = Workbooks.Open(filename) Application.ScreenUpdating = True End Function