This Procedure will ask for a file name to the user, will check if the file is open and if it’s not open it will open the file otherwise give a message to the user.
Dim Wb As Workbook, wkbk As Variant
‘get the dialog box to open the file
wkbk = Application.GetOpenFilename(“Excel Files,*.xls”)
If wkbk = False Then Exit Sub
‘check if its already opened in the Windows collection
Dim flag As Boolean
flag = False
For Each Wb In Workbooks
If Wb.Path & “\” & Wb.Name = wkbk Then
MsgBox “File is already open”, vbExclamation, “Workbook Open”
Wb.Activate
flag = True
End If
Next Wb
If flag = False Then Workbooks.Open (wkbk)
End Sub