Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-04-2005, 05:25 PM
Peter Schellenbach
Guest
 
Posts: n/a
Default Excel 2003 will not terminate with application.quit

When I use automation (VB, VBS, etc.) to open a workbook


in Excel 2003, the Quit method does not terminate the
Excel process. Each time the script is executed, another
Excel process is started, using about 10MB memory. I need
to use Task Manager to kill the process, lest I run out
of memory in a few days. Here is a sample script:

Dim XLApp
Dim XLWkb
Set XLApp = CreateObject("Excel.Application")
Set XLWkb = XLApp.Workbooks.Open("c:\xlbug.xls")
XLWkb.Close
Set XLWkb = Nothing
XLApp.Quit
Set XLApp = Nothing
'EXCEL.EXE should not be running anymore, but it is!

You can open any workbook file. I tested with a small
workbook file (two cells only) or a single-line text
file - same result. This problems does not happen with
Excel 2000.

Thanks,

Peter Schellenbach
Reply With Quote
  #2  
Old 03-04-2005, 07:08 PM
Dave Peterson
Guest
 
Posts: n/a
Default Re: Excel 2003 will not terminate with application.quit

I tried your code as a .vbs script and excel closed for me.

In fact, I thought maybe there was a prompt waiting for you so the xlwkb.close
line was still waiting.

If you have a volatile function (like =today(), =now(), =rand()), then that
workbook will recalculate when you open it. And maybe excel was waiting for you
to answer the "The workbook has changed--do you want to save it?" prompt.

But that message popped up nice and clear when I tested. (You would have
noticed it.)

Maybe adding

xlapp.visible = true

to your script would help you find the problem.

(tested with winxp home and xl2003)
Reply With Quote
  #3  
Old 03-04-2005, 07:25 PM
Jake Marx
Guest
 
Posts: n/a
Default Re: Excel 2003 will not terminate with application.quit

Hi Peter,

I would suggest adding False as the first argument to the Close method:

XLWkb.Close False

If you don't do this, Excel may, as Dave mentioned, be waiting for you to
answer "do you want to save changes". Were these workbooks created with
Excel 2000? If so, that would explain what you're seeing. Excel 2000
workbooks will always prompt you to save upon close when they are opened in
Excel 2003.

But regardless of what's causing the problem, adding False is a good
practice.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com
Reply With Quote
  #4  
Old 03-04-2005, 07:41 PM
Dave Peterson
Guest
 
Posts: n/a
Default Re: Excel 2003 will not terminate with application.quit

Unless you want to save those changes <vbg>.
Reply With Quote
  #5  
Old 03-04-2005, 08:00 PM
Jake Marx
Guest
 
Posts: n/a
Default Re: Excel 2003 will not terminate with application.quit

Good point. <g>

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com
Reply With Quote
  #6  
Old 03-04-2005, 11:17 PM
Peter Schellenbach
Guest
 
Posts: n/a
Default RE: Excel 2003 will not terminate with application.quit

Thanks Dave & Jake

After reading your responses, I loaded up a fresh copy of XP Pro / SP2 and
Office 2003 / SP1 on a test computer and tried the same test script. No
problem. However on my main desktop system, Excel indeed does not terminate.
It does not show up in the Applications, but does show up in Processes, and
chews up 10-20MB each time the script is run. I have a customer reporting the
same problem, which is why I am investigating. I did try adding False to the
XLWkb.Close method, but no difference. I also added XLApp.Visible=True to see
if any unexpected dialogs popped up, but nothing showed up and the Excel
process still did not terminate.

I also ran msconfig and selected "diagnostic startup" just in case some
other program was interferring, but still no luck.

Any more ideas?

Thanks,

Peter
Reply With Quote
  #7  
Old 03-04-2005, 11:35 PM
Dave Peterson
Guest
 
Posts: n/a
Default Re: Excel 2003 will not terminate with application.quit

The little sample script suffered from the same problem???

I don't have any other suggestions for that, but if that actually worked ok,
then maybe in the real script, you didn't release all your objects???

(But that's just one wild guess.)
Reply With Quote
  #8  
Old 03-08-2005, 06:25 PM
Peter Schellenbach
Guest
 
Posts: n/a
Default Re: Excel 2003 will not terminate with application.quit

Hi Dave -

Quote:
The little sample script suffered from the same problem???
Yes. That simple script was enough to keep Excel from terminating.

Looks like we found the problem. It appears that Google Desktop Search
Office AddIn somehow is getting a reference to the Excel object created by
the script, and never releases this reference. I uninstalled Google Desktop
Search and the problem is gone.

Thanks,

Peter
Reply With Quote
  #9  
Old 03-08-2005, 07:58 PM
Dave Peterson
Guest
 
Posts: n/a
Default Re: Excel 2003 will not terminate with application.quit

I just installed Google Desktop yesterday.

I've seen lots of posts that complain about that program messing up Excel.

One of the suggested fixes is to do a registry tweak.

But you could try turning the google desktop back on, but turn off the COM addin
in excel (and Word and PPT??).

In excel,
Tools|customize|Commands tab|Tools Category
Scroll down the commands listbox and
Drag "COM Add-ins..." to under Tools|Addins
(It seems to make sense there.)

Then close up that dialog.

Back to Tools|COM Add-ins...
Turn off the google desktop search addin.

Maybe you can still use the desktop addin then.

====
PS. I read a few posts about google desktop causing trouble--but that was with
the beta version of the program. I guess Google just released it into
"production" recently.

Maybe the new version doesn't have this trouble. (Maybe a download of the most
current version would be in order for testing.)

Peter Schellenbach wrote:
Quote:
Hi Dave -

The little sample script suffered from the same problem???

Yes. That simple script was enough to keep Excel from terminating.

Looks like we found the problem. It appears that Google Desktop Search
Office AddIn somehow is getting a reference to the Excel object created by
the script, and never releases this reference. I uninstalled Google Desktop
Search and the problem is gone.

Thanks,

Peter
--

Dave Peterson
Reply With Quote
  #10  
Old 03-08-2005, 09:00 PM
Dave Peterson
Guest
 
Posts: n/a
Default Re: Excel 2003 will not terminate with application.quit

Ps. The registry tweak did the same as turning off that comaddin. (I find
going through menus safer than touching the registry.)
Reply With Quote
  #11  
Old 03-14-2005, 01:18 PM
tedgar tedgar is offline
Novice
 
Join Date: Mar 2005
Posts: 1
tedgar
Default re:Excel 2003 will not terminate with application.quit

I am experiencing the exact same problem, BUT I do not have the Google Desktop Search AddIn. I am seeing this on an XP Pro machine as well as a W2K machine.

Could there be any other addIns that can cause a similar symptom?

Thanks,
Tom
Reply With Quote
  #12  
Old 03-18-2005, 07:45 PM
Fredrik Wahlgren
Guest
 
Posts: n/a
Default Re: re:Excel 2003 will not terminate with application.quit

None that I'm aware of. It may make sense to create a minimal application
that simply starts Excel and the calls Quit followed by a release of the
refernec. It's possible that ther real program you have doesn't release all
the refernces it holds. If the minimal program works OK, you probably have
this kind of problem.

Best Regards,
Fredrik
Reply With Quote
  #13  
Old 03-14-2006, 05:28 PM
bwjunkie bwjunkie is offline
Novice
 
Join Date: Mar 2006
Posts: 1
bwjunkie
Send a message via ICQ to bwjunkie Send a message via AIM to bwjunkie
Default excel not closing

i can reproduce this exact same problem with my vb.net application, and have found some interesting semi-solution

i CANNOT get excel.exe to drop out of my process list, when i automate, even trying all the above technique and using all the close/quit functions.

once i fully close my .net application, the processes dissappear.

even if i say .visible=true, and then i close it with the mouse, the process stays open.

when i close my application completely, then the excel.exe process dissappears.

im not using late binding however.
i use the new excel.application with proper office references.

not sure how this info helps, but just FYI

josh
josh at pipeline dot com

sample code below
Dim oxls As Excel.Application
Dim oBook As Excel.Workbook
Dim oSheet As Excel.Worksheet
Try
oxls = New Excel.Application
oxls.DisplayAlerts = False
oxls.Visible = False
oBook = oxls.Workbooks.Open(Me.txtGoodList.Text)
oSheet = oBook.ActiveSheet
Me.SheetToDataset(oSheet, Me.DsGOOD.tList)
oxls.Visible = True
oBook.Close(False)
oxls.Quit()
Catch ex1 As Exception
oxls.Visible = True
oBook.Close(False)
oxls.Quit()
Throw ex1
End Try
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 - Different Header for each page franklyorange Excel 0 08-26-2008 02:26 PM
Powerpoint 2003 - slides with Excel text franklyorange PowerPoint 0 08-19-2008 09:30 AM
Excel 2003 will not terminate with application.quit Run Outside application from toolbar button Richard Harison Word 3 12-20-2005 03:22 PM
Application not found error when trying to open .pdf files. Dave Outlook 2 12-15-2005 01:01 PM
Excel 2003 will not terminate with application.quit access runtime application will not install markjean Office 1 12-06-2005 02:15 AM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 05:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft