Another Quit problem
I'm having the same problem, although I'm using Excel through .Net Interop.
My code is:
Dim app As New Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
wb = app.Workbooks.Open(PathAndFilename)
ws = wb.Worksheets(1)
app.DisplayAlerts = False
ws.SaveAs(PathAndFilename)
app.Workbooks(1).Close()
app.Quit()
ws = Nothing
wb = Nothing
app = Nothing
I even tried adding GC.Collect, but that didn't do it either. I still see a
copy of EXCEL.EXE in Task Manager. I'm starting to think I need to do
Thread.Kill or something drastic like that.
"Dave Peterson" wrote:
Any chance excel is sitting there waiting for a response from the user?
maybe adding a line to make excel visible will lead you to an answer.
Sub Main()
Dim oExcel
Dim oWorkBook
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
Set oWorkBook = oExcel.WorkBooks.Open("C:\TEST.XLS")
oWorkBook.Close False
Set oWorkBook = Nothing
oExcel.Quit
Set oExcel = Nothing
End Sub
Paul van Kan wrote:
Hi All,
I have read a lot about problems with getting Excel to quit from VBScript,
but none of the suggestions seem to work for me. I am using VBScript 5.6 and
Excel 2002 SP3.
It doesn't get much simpler than this:
Sub Main()
Dim oExcel
Dim oWorkBook
Set oExcel = CreateObject("Excel.Application")
Set oWorkBook = oExcel.WorkBooks.Open("C:\TEST.XLS")
oWorkBook.Close False
Set oWorkBook = Nothing
oExcel.Quit
Set oExcel = Nothing
End Sub
Still, Excel is remaining active in the task-manager after running this
snippet. Leaving out the workbook-stuff (just starting and closing Excel)
works fine, but as soon as I start using an actual workbook, Excel won't
quit.
Does anybody have any ideas on how to solve this?
Thanks,
Paul
--
Dave Peterson
|