473,395 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Inability to End Excel Process

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
4 4260
"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
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sri | last post by:
I am writing an asp.net applicaition using VB coding. In a function, I am opening an excel file with the following code, Dim objExcel As Object Dim objWorkBook As Object objExcel =...
10
by: Lars-Erik Aabech | last post by:
Hi! This issue have been discussed a lot, but I haven't found a solution that applies to ASP.NET. I have a library which does some operations on Excel documents, and it will be used in an...
2
by: Praveen K | last post by:
I have a problem in communicating between the C# and the Excel Interop objects. The problem is something as described below. I use Microsoft Office-XP PIA dll’s as these dll’s were been...
2
by: Powerguy | last post by:
Hi all, I am looking for a way to get the Process id (or a handle) of an EXCEL process created from within my code. For example when the following code is executed: Dim EXL As...
18
by: lgbjr | last post by:
Hi All, I have a VB.NET app that, among other things, writes data to Excel. I am having trouble getting the Excel process to terminate after I quit Excel. I found an article related to this...
16
by: LP | last post by:
Hello, I am trying to use .NET with Excel. I installed Office 2003 and selected ..NET programming suport option, so it installed all those PIA, as MS sugests. But I can not find a way to destroy...
5
by: mabond | last post by:
Hi recently read a posting and reply about Excel processs still running after the Appliction.Quit was called. Thought I might be able to use the same...
1
by: fakehitswizard | last post by:
this is the correct way to close excel with C#. I've seen alot of other bogus posts ALL over the web that don't work, how frustrating. string savepath; bool foundPID; int ourPID = 0; int...
7
by: =?Utf-8?B?VGVycnkgSG9sbGFuZA==?= | last post by:
I have a vb.net app that opens an excel worksheet, reads data and then closes the sheet. Im noticing that the Excel process is still running after I have closed and disposed of my excel objects. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.