![]() |
#1
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
![]()
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) |
#3
|
|||
|
|||
![]()
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 |
#4
|
|||
|
|||
![]()
Unless you want to save those changes <vbg>.
|
#5
|
|||
|
|||
![]() |
#6
|
|||
|
|||
![]()
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 |
#7
|
|||
|
|||
![]()
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.) |
#8
|
|||
|
|||
![]()
Hi Dave -
Quote:
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 |
#9
|
|||
|
|||
![]()
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:
Dave Peterson |
#10
|
|||
|
|||
![]()
Ps. The registry tweak did the same as turning off that comaddin. (I find
going through menus safer than touching the registry.) |
#11
|
|||
|
|||
![]()
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 |
#12
|
|||
|
|||
![]()
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 |
#13
|
|||
|
|||
![]()
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 |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
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 |
![]() |
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 |
![]() |
markjean | Office | 1 | 12-06-2005 02:15 AM |