View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default 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)



Peter Schellenbach wrote:

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


--

Dave Peterson