Check if Excel file is already open
Hi Robert
No path needed in my function.
Regards,
Per
"Robert Crandal" skrev i meddelelsen
...
Hi Per Jessen
Does your function need to have the path along with
the filename itself?? I'm just curious if it would better
to use "C:\Mydata\Book1.xls" as opposed to just
"Book1.xls" as the parameter to your function.
thank u
"Per Jessen" wrote in message
...
Hi
Look at this:
Sub Test()
If Not IsWbOpen("Book1.xls") then
Workbooks.Open("Book1.xls")
End If
End Sub
Function IsWbOpen(WbName As String) As Boolean
For Each wb In Application.Workbooks
If wb.Name = WbName Then
IsWbOpen = True
Exit For
End If
Next
End Function
|