Hello,
I create an excel file with sbo data in a little program with SDK Vb.net
But even if Excel is closed, the excel process still running.
In VB, I have write those line in order to release object but no more change :
System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelApplication) System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelDocument)
Could you help me please.
L.P.
I don´t know why, but if you call GC.Collect() 2x at the end of your code, it works.
...
System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelApplication)
ExcelDocument = Nothing
ExcelApplication = Nothing
GC.Collect()
GC.Collect()
Ribeiro Santos
Hi,
Try set the excel object to nothing.
I tried with
Dim oExcel As Excel.Application
oExcel = New Excel.Application
oExcel.Visible = True
oExcel.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel)
oExcel = Nothing
and work fine.
See
http://support.microsoft.com/?kbid=317109
Ribeiro Santos
Hi,
I try to close and set to nothing all Excel object but it is the same.
I have the same code for word and it work fine. I don't find where is the problem for excel 😔
Tks again
Here is my code
Public ExcelApplication As Excel.Application
Public ExcelDocument As Excel.Workbook
-
ExcelApplication = New Excel.Application
-
ExcelDocument = ExcelApplication.Workbooks.Open(path + fichier, , , , , , , , , , , , )
-
ExcelDocument.SaveAs(filename:=s)
ExcelApplication.Workbooks.Close()
ExcelDocument = ExcelApplication.Workbooks.Open(ini.files)
ExcelApplication.Visible = True
-
ExcelApplication.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelApplication)
ExcelDocument = Nothing
ExcelApplication = Nothing
Tks You All
It works Now with this code :
ExcelDocument = Nothing
ExcelApplication.Quit()
ExcelApplication = Nothing
GC.Collect()
Add a comment