DoCmd.TransferSpreadsheet help

G

Guest

Hello

I'm using the DoCmd.TransferSpreadsheet function to import data from an excel spreadsheet. After the transfer is complete, there is still an instance of excel residing in the taskmanager. Each time the DoCmd.TransferSpreadsheet function is run, another instance is created.

How can I kill the excel processes after performing the DoCmd.TransferSpreadsheet function

TIA
 
K

Ken Snell

This command in and of itselft does not normally leave an instance of EXCEL
running. Are you by chance opening EXCEL or creating a reference to it in
your code? Post the code that you're using, including lines before and after
the TransferSpreadsheet step.


--
Ken Snell
<MS ACCESS MVP>

cliff said:
Hello,

I'm using the DoCmd.TransferSpreadsheet function to import data from an
excel spreadsheet. After the transfer is complete, there is still an
instance of excel residing in the taskmanager. Each time the
DoCmd.TransferSpreadsheet function is run, another instance is created.
How can I kill the excel processes after performing the
DoCmd.TransferSpreadsheet function?
 
G

Guest

Ken

Here's the code. I open the workbook and check to see if certain tabs exist in the worksheet. If so, I transfer into the appropriate tables. The workbook is closed. Can you help?

Clif

Set xlapp = CreateObject("Excel.Application"
Set xlBook = xlapp.Workbooks.Open(savefilename


sheetname = "Template1
If SheetExists(xlBook, sheetname) The
objAccess.DoCmd.TransferSpreadsheet acImport, , "ActiveTemplate", savefilename, True
End I

sheetname = "TemplateDetails
If SheetExists(xlBook, sheetname) The
objAccess.DoCmd.TransferSpreadsheet acImport, , "TemplateDetails", savefilename, True
End I

'// Clean u
xlBook.Close savechanges:=Fals

Set xlBook = Nothin

'// Close Microsoft Excel with the Quit method
xlapp.Qui

'// Release the objects
Set xlapp = Nothing
 
K

Ken Snell

I've never had the EXCEL file open when doing a TransferSpreadsheet action,
so I can't say if ACCESS might be creating a new instance of it or not.

I don't see anything in this code that would seem to cause EXCEL to remain
running.

However, I'm more inclined to think that you may have "open" reference in
your SheetExists function. Post that code and let's see.

--
Ken Snell
<MS ACCESS MVP>


cliff said:
Ken,

Here's the code. I open the workbook and check to see if certain tabs
exist in the worksheet. If so, I transfer into the appropriate tables. The
workbook is closed. Can you help?
 
A

adam r

just an idea, take it or leave it....

you could just kill excel.exe at the end of your routine thru dos with
the shell command. if you are using any windows version past 98
though there is no kill command built in. the solution i've found is
the pskill command from the pstools suite that can be downloaded at
www.sysyinternals.com. very handy

ducky
 

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