Killing Excel process from Acess2000 VBA

T

Tom

I'm asking you to look at this:
I'm doing an export from A2000 to Excel2007 from VBA in Access2000
using
an app as Excel.Application object:)

set app= new Excel.Application

Everything goes fine :) but I cant easily see the fruits of my work
because after A2000 VBA code is done, it seems that the invisible
Excel process, initiated
by A2000 VBA code is still running and to open Excel I first have to
manually kill the Excel
process in Windows Task Manager.
So my simple question is:
How to release the app as Excel.Application object programatically
from A2000 VBA.
I tried:
set app=nothing or
app.quit
but none of these is working.

Thanks
Tom
 
T

Tom van Stiphout

On Sat, 12 Jan 2008 12:18:47 -0800 (PST), Tom <[email protected]>
wrote:

Invisible? Then make it visible:
app.Visible = True

"set app = Nothing" typically closes the object, so you must have
something special going on.

-Tom.
 
B

boblarson

If you reference any Excel methods or properties by reference instead of
explicitly, such as Selection, ActiveCell, ActiveWorkbook, etc., instead of
your objWB.ActiveCell etc. then Access will hold the reference open until
Access closes. To make sure that everything closes when you want it to, make
sure to EXPLICITLY reference the item.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
If my post was helpful to you, please rate the post.
__________________________________
 
T

Tom

I followed your advice and additionaly did something else.
I wrote a dummy Sub in A2000 VBA with app as Excel.Application E2007
object
which just created one workbook and filled one cell.
At the beginning of the Sub there was app.visible=true as you
suggested
At the end of that Sub there was:
app.quit
set app=nothing
And that did the whole Job - there is no flying loose Excel process
left.
So my conclusion is that this loose Excel process of mine is side-
effect
of my exporting procedure (recorded macro) from A2000 to E2007, maybe
from some
linking or connections between the two apps after my previous
exporting.
As I didn't know how to handle it,
in the end I resorted to the old good DAO recordset obj and
excel.range.copyfromrecordset
method to make this exporting Sub between A2000 and E2007.

But thanks anyway for directions.
Tom
 
T

Tom

As for what Bob Larson wrote:
I wrote 2 versions of my dummy Sub in VBA A2000 referring to app as
new Excel.Application obj E2007.
One where in only one place I didn't explicitly referenced for example
Sheets(i) or Range objs
and second where I explicitly used objWorkbook reference and it is all
as you said - implicit referencing leaves a loose Excel process but
after referencing explicitly
through objWorkbook it is possible to close Excel for good.
I must say I was troubled by this problem for some time and almost
grew to think that the problem was inevitable but it is all past time
now.
Many thanks

Tom
 

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