Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Inability to End Excel Process

11 views
Skip to first unread message

Henry Stockbridge

unread,
Feb 15, 2007, 4:00:39 PM2/15/07
to
Hi,

I am using Access 2003 to automate an Excel workbook, but after the
code completes Excel does not quit (at least it is still listed in
Task Manager --> Processes.)

I have set a reference to the Excel 11.0 object library. I have
declared my Excel variables as...

Dim appExcel
Set appExcel = CreateObject("Excel.application")

.. opened the file...

appExcel.Workbooks.Open ("c:\PhysicianUpdates\" & qdf.Name & ".xls")

.. and clean up when done...

ActiveWorkbook.Save
appExcel.ActiveWorkbook.Saved = True
appExcel.Quit

Set appExcel = Nothing
Set rst = Nothing
Set qdf = Nothing

Set db = Nothing

Any ideas why Excel will not truly quit? Any help you can lend would
be appreciated.

Henry

RoyVidar

unread,
Feb 15, 2007, 4:51:27 PM2/15/07
to
"Henry Stockbridge" <hstock...@hotmail.com> wrote in message
<1171573235.9...@s48g2000cws.googlegroups.com>:

You are using unqualified references to Excel objects.

ActiveWorkbook.Save needs to be

appExcel.ActiveWorkbook.Save

I'm more in favour of using a separate worbkook object

dim wr as object ' or Excel.Workbook
set wr = appExcel.Workbooks.Open("c:\PhysicianUpdates\" & qdf.Name &
".xls")

' do important stuff

wr.save
DoEvents
set wr = nothing
appExcel.Quit
set appExcel = nothing

BTW - you say you have set reference, but you declare your appExcel
as variant - for early binding

dim appExcel as Excel.Application

--
Roy-Vidar


Henry Stockbridge

unread,
Feb 15, 2007, 5:58:37 PM2/15/07
to
On Feb 15, 3:51 pm, RoyVidar <roy_vidarNOS...@yahoo.no> wrote:
> "Henry Stockbridge" <hstockbrid...@hotmail.com> wrote in message
>
> <1171573235.953818.177...@s48g2000cws.googlegroups.com>:
> Roy-Vidar- Hide quoted text -
>
> - Show quoted text -

Thanks, Roy. Unfortunately, it wasn't successful. The code is hooked
to the click event of a control on a form. If I close the database,
the Excel process ends. If the code were put into an independent
module instead on the click event of a control, might that solve the
problem?

Henry

RoyVidar

unread,
Feb 16, 2007, 3:42:16 AM2/16/07
to
"Henry Stockbridge" <hstock...@hotmail.com> wrote in message
<1171580317....@j27g2000cwj.googlegroups.com>:

If this wasn't successfull, then I think it is possible that you use
more unqualified referencing in the rest of your code, that needs to
be amended. But to be of assistance, we would need a bit more than
"Unfortunately, it wasn't successfull".

I don't think there would be any difference whether this resides in
a separate module vs within a forms module, the code needs to be
without any implicit referencing of Excel objects, properties and
methods.

Here's one Microsoft KB article with some information on what I think
is the problem
http://support.microsoft.com/default.aspx?kbid=178510

--
Roy-Vidar


Henry Stockbridge

unread,
Feb 16, 2007, 5:25:53 PM2/16/07
to
On Feb 16, 2:42 am, RoyVidar <roy_vidarNOS...@yahoo.no> wrote:
> "Henry Stockbridge" <hstockbrid...@hotmail.com> wrote in message
>
> <1171580317.533874.99...@j27g2000cwj.googlegroups.com>:

Many thanks for the help. I qualified my range and cell objects and
now everything works like a charm.

Henry

0 new messages