| re: Unable to quit Excel OLE app from vb .net
In case anyone is interested, I stumbled upon the
answer. I must call two "garbage collection" lines at
the very end of the code:
GC.Collect()
GC.WaitForPendingFinalizers()
Boy, while vb .net might give you a little more power
than 6.0, it amazes me how difficult it is to do some
simple things.
[color=blue]
>-----Original Message-----
>Can anyone tell me why the following code fails to quit
>Excel for me.
>
>If I comment out the four lines that reference the
>workbook, Excel closes.
>
>excel = CreateObject("excel.application")
>excelworkbook = excel.Workbooks.Open(in_file)
>excelworkbook.close()
>System.Runtime.InteropServices.Marshal.ReleaseCom Object
>(excelworkbook)
>excelworkbook = Nothing
>excel.quit()
>System.Runtime.InteropServices.Marshal.ReleaseCom Object
>(excel)
>excel = Nothing
>
>Thanks for any help.
>
>Mike Sweet
>
>.
>[/color] |