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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top