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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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...)
 
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.
 
Back
Top