I try do open, edit, and save a word document and an excel workbook in my program.
I write some code like below.
After the program exit,
I find the WORD.EXE in TaskManager is quit, but the EXCEL.EXE is still running.
Why does the oExcel.quit() not work??
Please give me some advice, thanks!!
Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application();
object fileName = @"D:\Combo.docx";
Document oDoc = oWord.Application.Documents.Open(ref fileName, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
...
oDoc.Close(ref saveChange, ref oMissing, ref oMissing);
oDoc = null;
oWord.Quit(ref saveChange, ref oMissing, ref oMissing);
oWord = null;
...
Microsoft.Office.Interop.Excel.Application oExcel = new Microsoft.Office.Interop.Excel.Application();
String fileName3 = @"D:\Combo.xlsx";
Workbook excelWorkbook = oExcel.Workbooks.Open(fileName3,
0, false, 5, "", "", false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
...
excelWorkbook.Close(saveChange, oMissing, oMissing);
excelWorkbook = null;
oExcel.Quit();
oExcel = null;