How to import from excel to access and close excel after.

G

Guest

I have written a program that imports all worksheets from a number of files.

I create an excel object ( Set objXL = CreateObject("Excel.Application"))

use DoCmd TransferSpreadsheet acImport

then close the object. (objXL.Quit Set objXL = Nothing)

But when i look in task manager, processes excel is still running.

Is there a way to completely shut excel down, or is there a different method
of importing the spreadsheets?

Thanks in advance

Batty
 
J

John Nurick

I find it best to explicitly close all the workbooks before quitting the
app, e.g.

With objXL.Workbooks
Do While .Count > 0
.Item(.Count).Close False
Loop
End With
objXL.Quit

Also, make certain that you don't have any object variables pointing to
other Excel objects (a range, a worksheet, a workbook...)
 
G

Guest

objXl.quit

But why are you opening an instance of Excel. It is unnecessary for the
TransferSpreadsheet method. You only need to create an instance of Excel if
you are programmatically working in a spreadshet.
 

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