General information
Title:
How can I detect if Excel is already running?
In various places in our application I use the following code to create an Excel object and export data:-
oExcel=CREATEOBJECT("Excel.Application")
oExcel.Workbooks.Add()
IF UPPER(oExcel.Name)= "OBJECT"
lHasExcel97 = .T.
oExcel = oExcel.Sheets[1]
ELSE
lHasExcel97 = .F.
ENDIF
This works nicely if Excel is not yet running but if the user already has Excel running on his PC then this code will again invoke Excel rather than use the existing Excel application.
How can I change the code to detect if Excel is already running and, if so, simply add a new Workbook to the existing Excel application.
cheers,
Alain Legrand
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only