View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default Check if Excel file is already open

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

Regards,
Per

"Robert Crandal" skrev i meddelelsen
...
I need to check if an Excel file is already open.
How do i do this?

thank u