Function BookOpen(Bk As String) As Boolean
Dim t As Excel.Workbook
On Error Resume Next
'if the code runs into a error, it skips it and continues
Set t = Application.Workbooks(Bk)
BookOpen = Not t Is Nothing
' if teh workbook is open, then t will hold the workbook object and _
therefore will NOT be nothing
On Error GoTo 0
End Function
Sub Test()
Dim isopen As Boolean, bookname As String
book
Name = "Test.xls"
isopen = BookOpen(bookname) ' calling the function
If isopen Then
MsgBox ("is open")
Else
Workbooks.Open Filename:= _
"C:\Temp\Test.xls"
End If
End Sub