G
Guest
I'm using the following code to open a session of Excel and file(s). The
user can then return to the form and run another query which calls this
procedure again and is opening another session of Excel. I end up with
several Excel sessions being open. I'd like to be able to check to see if a
session of Excel is already open and use that session to open the additional
file(s). What's the best way to do this?
Dim XL As Excel.Application
Set XL = CreateObject("Excel.Application")
XL.Visible = True ' make Excel visible
If strExcelFileName <> "" Then
XL.Workbooks.Open FileName:=strExcelFileName
End If
user can then return to the form and run another query which calls this
procedure again and is opening another session of Excel. I end up with
several Excel sessions being open. I'd like to be able to check to see if a
session of Excel is already open and use that session to open the additional
file(s). What's the best way to do this?
Dim XL As Excel.Application
Set XL = CreateObject("Excel.Application")
XL.Visible = True ' make Excel visible
If strExcelFileName <> "" Then
XL.Workbooks.Open FileName:=strExcelFileName
End If