473,786 Members | 2,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("E xcel.applicatio n")

... opened the file...

appExcel.Workbo oks.Open ("c:\PhysicianU pdates\" & qdf.Name & ".xls")

... and clean up when done...

ActiveWorkbook. Save
appExcel.Active Workbook.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 4279
"Henry Stockbridge" <hs***********@ hotmail.comwrot e in message
<11************ **********@s48g 2000cws.googleg roups.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("E xcel.applicatio n")

.. opened the file...

appExcel.Workbo oks.Open ("c:\PhysicianU pdates\" & qdf.Name & ".xls")

.. and clean up when done...

ActiveWorkbook. Save
appExcel.Active Workbook.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.Active Workbook.Save

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

dim wr as object ' or Excel.Workbook
set wr = appExcel.Workbo oks.Open("c:\Ph ysicianUpdates\ " & 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.Applicati on

--
Roy-Vidar
Feb 15 '07 #2
On Feb 15, 3:51 pm, RoyVidar <roy_vidarNOS.. .@yahoo.nowrote :
"Henry Stockbridge" <hstockbrid...@ hotmail.comwrot e in message

<1171573235.953 818.177...@s48g 2000cws.googleg roups.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("E xcel.applicatio n")
.. opened the file...
appExcel.Workbo oks.Open ("c:\PhysicianU pdates\" & qdf.Name & ".xls")
.. and clean up when done...
ActiveWorkbook. Save
appExcel.Active Workbook.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.Active Workbook.Save

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

dim wr as object ' or Excel.Workbook
set wr = appExcel.Workbo oks.Open("c:\Ph ysicianUpdates\ " & 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.Applicati on

--
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.comwrot e in message
<11************ *********@j27g2 000cwj.googlegr oups.com>:
On Feb 15, 3:51 pm, RoyVidar <roy_vidarNOS.. .@yahoo.nowrote :
>"Henry Stockbridge" <hstockbrid...@ hotmail.comwrot e in message

<1171573235.95 3818.177...@s48 g2000cws.google groups.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("E xcel.applicatio n")
.. opened the file...
>>appExcel.Work books.Open ("c:\PhysicianU pdates\" & qdf.Name &
".xls") .. and clean up when done...
>>ActiveWorkboo k.Save
appExcel.Acti veWorkbook.Save d = True
appExcel.Qu it
>>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.Activ eWorkbook.Save

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

dim wr as object ' or Excel.Workbook
set wr = appExcel.Workbo oks.Open("c:\Ph ysicianUpdates\ " & qdf.Name &
".xls")

' do important stuff

wr.save
DoEvents
set wr = nothing
appExcel.Qui t
set appExcel = nothing

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

dim appExcel as Excel.Applicati on

--
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
"Unfortunat ely, 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.comwrot e in message

<1171580317.533 874.99...@j27g2 000cwj.googlegr oups.com>:


On Feb 15, 3:51 pm, RoyVidar <roy_vidarNOS.. .@yahoo.nowrote :
"Henry Stockbridge" <hstockbrid...@ hotmail.comwrot e in message
<1171573235.953 818.177...@s48g 2000cws.googleg roups.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("E xcel.applicatio n")
.. opened the file...
>appExcel.Workb ooks.Open ("c:\PhysicianU pdates\" & qdf.Name &
".xls") .. and clean up when done...
>ActiveWorkbook .Save
appExcel.Activ eWorkbook.Saved = True
appExcel.Qui t
>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.Active Workbook.Save
I'm more in favour of using a separate worbkook object
dim wr as object ' or Excel.Workbook
set wr = appExcel.Workbo oks.Open("c:\Ph ysicianUpdates\ " & 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.Applicati on
--
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
"Unfortunat ely, 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.microso ft.com/default.aspx?kb id=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
10699
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 = CreateObject("Excel.Application") objWorkBook = objExcel.Workbooks.Open(targetfilename) * targetfilename is a variable that stores the excel file name and path. In the error handler,
10
3074
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 ASP.NET application. If I use the library in a Forms application, the Excel process is removed when the cleanup operations are done, but with ASP.NET all possible ways to clean up fails. The following code has been tried:
2
5438
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 recommended by many for web applications. I create the instances of Excel, Workbook and the worksheet. And later on Release the references by “System.Runtime.InteropServices.Marshal.ReleaseComObject(Object)” and making the object as null finally....
2
21956
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 Excel.Application = New Excel.Application a new instance of EXCEL.EXE is created in the task manager.
18
3096
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 problem: http://support.microsoft.com/default.aspx?scid=kb;en-us;317109 Below is a sample of code that I wrote based on the above article. The excel workbook, worksheets, and all of the cells are properly formatted when Excel
16
4553
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 Excel process, it still hangs in the taks manager' Processes as running. I am trying very simple code (see below), but Excel wont go away, I tried just about anything I could find on MSDN or by Google. Even calling WIN32 API to destroy Excel. But...
5
6582
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 (System.Runtime.InteropServices.Marshal.ReleaseComObject(exApplication)) to solve my problem but could not. Background : My app uses a WebBrowser control to display to the user the contents of an Excel spreadsheet.:
1
4288
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 tmpX = 0; int indexRow = 1; int indexCol = 1; int existingPIDs;
7
2165
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. The following code (Test1) demonstrates the essence of what I am doing. When I check the processes while ruinning the method, I notice that the Excel process remains after exiting the sub (and until I exit the application) Sub Test1 Dim...
0
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.