Another approach might be.
Option Explicit
Sub Example()
Dim wbEx As Workbook
Dim i As Integer
Const cPath = "C:\files\"
Const cFileName = "myworkbook.xls"
For i = 1 To Application.Workbooks.Count
If Application.Workbooks(i).Name = cFileName Then
Set wbEx = Workbooks(cFileName)
Exit For
End If
Next
If wbEx Is Nothing Then
If Dir(cPath & cFileName) <> "" Then
Workbooks.Open cPath & cFileName
Set wbEx = Workbooks(cFileName)
Else
MsgBox cPath & cFileName & Chr(10) & Chr(10) & "Could not be found"
Exit Sub
End If
End If
' begin your code here
End Sub
Bookmarks