G
Guest
I'm using the following code to open Excel and a file(s). The user can then
run another query which would again call the procedure containing this code
and I end up with another session of Excel open. I would like to check for
an open Excel session and use that session if it is open. How can I best
accomplish 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
run another query which would again call the procedure containing this code
and I end up with another session of Excel open. I would like to check for
an open Excel session and use that session if it is open. How can I best
accomplish 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