By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Inability to End Excel Process

P: n/a
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

Feb 15 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Henry Stockbridge" <hs***********@hotmail.comwrote in message
<11**********************@s48g2000cws.googlegroups .com>:
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
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
Feb 15 '07 #2

P: n/a
On Feb 15, 3:51 pm, RoyVidar <roy_vidarNOS...@yahoo.nowrote:
"Henry Stockbridge" <hstockbrid...@hotmail.comwrote in message

<1171573235.953818.177...@s48g2000cws.googlegroups .com>:


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

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- 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

Feb 15 '07 #3

P: n/a
"Henry Stockbridge" <hs***********@hotmail.comwrote in message
<11*********************@j27g2000cwj.googlegroups. com>:
On Feb 15, 3:51 pm, RoyVidar <roy_vidarNOS...@yahoo.nowrote:
>"Henry Stockbridge" <hstockbrid...@hotmail.comwrote in message

<1171573235.953818.177...@s48g2000cws.googlegroup s.com>:


>>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

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- 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
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
Feb 16 '07 #4

P: n/a
On Feb 16, 2:42 am, RoyVidar <roy_vidarNOS...@yahoo.nowrote:
"Henry Stockbridge" <hstockbrid...@hotmail.comwrote in message

<1171580317.533874.99...@j27g2000cwj.googlegroups. com>:


On Feb 15, 3:51 pm, RoyVidar <roy_vidarNOS...@yahoo.nowrote:
"Henry Stockbridge" <hstockbrid...@hotmail.comwrote in message
<1171573235.953818.177...@s48g2000cws.googlegroups .com>:
>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
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- 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

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 problemhttp://support.microsoft.com/default.aspx?kbid=178510

--
Roy-Vidar- Hide quoted text -

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

Henry

Feb 16 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.