Access Bug?

L

Luis

Hello.
I have a module that creates 2 different Excel application
objects. I create one object, process the object and do
set Wbxl=Nothing. I repeat the same process to the second
object.
The big problem is that only one of the objects is killed.
If i go to Windows Task Manager there is still one
Excel.Exe process. This causes that when i close the
database I get an Excel exception error.
Is it an Access bug or am i doing something wrong? The
code i'm using looks like this:

Public Function Process_cell()
Dim wbxl As Object
Dim wbxl2 As Object

Set wbxl = CreateObject("Excel.application")
Path = "mypath"
wbxl.DisplayAlerts = False
wbxl.Workbooks.Open Path
DoCmd.TransferSpreadsheet acImport,
acSpreadsheetTypeExcel9, "mytable1", "Path",
True, "A2:IV65536"
wbxl.ActiveWorkbook.Close savechanges:=False
wbxl.Quit
Set wbxl = Nothing


Set wbxl2 = CreateObject("Excel.application")
Path = "mypath2"
wbxl2.DisplayAlerts = False
wbxl2.Workbooks.Open Path
DoCmd.TransferSpreadsheet acImport,
acSpreadsheetTypeExcel9, "mytable2", "Path",
True, "A2:IV65536"
wbxl2.ActiveWorkbook.Close savechanges:=False
wbxl2.Quit
Set wbxl2 = Nothing
End Function
 
F

Frank Stone

i'm guessing but what i noticed while looking over your
code was for wbxl2 you set wbxl2 = nothing. but for wbxl1
you set wbxl = nothing. shouldn't that be wbxl1??
i don't know if thats it but try it.
 
L

Luis

In the code there is no wbxl1. Or at least i didn't find
it, but if there is that's a writing error. Assuming that
the name of the objects are correct, the problem that i
reported still persists.
Can you help me on this?
 

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