Call to Excel from Word keeps active XL process

C

Cheri

I have a VBA macro in Word that pulls a list of information from an Excel
spreadsheet. I'm using the following code:

Set xlApp = CreateObject("Excel.Application")
With xlApp
.Visible = False
.Workbooks.Open FileName:=strFileName
End With

Then at the end of my module:
xlApp.Quit
Set xlApp = Nothing

Problem is that Excel continues to run. I have to go into Task Manager and
end the process.

If there a way to have the Excel process programmatically?
 
J

Jean-Guy Marcil

Cheri said:
I have a VBA macro in Word that pulls a list of information from an Excel
spreadsheet. I'm using the following code:

Set xlApp = CreateObject("Excel.Application")
With xlApp
.Visible = False
.Workbooks.Open FileName:=strFileName
End With

Then at the end of my module:
xlApp.Quit
Set xlApp = Nothing

Problem is that Excel continues to run. I have to go into Task Manager and
end the process.

If there a way to have the Excel process programmatically?

Depending on what you are doing with your xlApp object, it probably happens
that eventhough you are trying to "Quit" it, Excel cannot becasue it might be
waiting for user interaction.

Change
.Visible = False
to
.Visible = True
and debug your code to see what is going on.
 
Top