I wrote this code in VB2005 Express Beta. When the Sub ends, Excel still
shows as a running process in the Task Manager. How do I shut Excel down?
Thanks,
Kenneth Hutson
San Antonio, TX
[code]
Imports Microsoft.Office.Interop
Module DataSet2Excel
Sub startxl()
Dim xlapp As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Dim r As Excel.Range
xlapp = New Excel.Application
xlapp.Visible = True
wb = xlapp.Workbooks.Add
ws = CType(wb.Worksheets.Add, Excel.Worksheet)
xlapp.Workbooks.Close()
xlapp.Quit()
End Sub
Chuck - 18 Apr 2005 16:24 GMT
Try
xlapp.Application.Quit()
Also
xlapp = nothing
or
set xlapp = nothing (not familiary with VB2005 but in VBA you'd set the
xlapp object with
set xlapp = New Excel.Application
and you'd destroy it with
set xlapp = nothing
You may also need to destroy your ws object.
> I wrote this code in VB2005 Express Beta. When the Sub ends, Excel still
> shows as a running process in the Task Manager. How do I shut Excel down?
[quoted text clipped - 34 lines]
>
> End Sub
Perry - 18 Apr 2005 22:08 GMT
I'm wondering how the Quit() method is part of the Excel.Application
namespace.
Did you get this line through the JIT compiler ?
Try to instantiate the Excel object using :
Dim xlapp As New Excel._ApplicationClass()
You can also try to Dispose() the "xlapp" object or force the GC (garbage
collector) to collect.
Krgrds,
Perry
> I wrote this code in VB2005 Express Beta. When the Sub ends, Excel still
> shows as a running process in the Task Manager. How do I shut Excel down?
[quoted text clipped - 34 lines]
>
> End Sub