varghesejim
New Member
- Joined
- Oct 7, 2014
- Messages
- 2
We are opening an excel file from our application and display that to the user
This works and opens the excel file for the user. However, when the user closes the excel file, excel.exe still remains in memory.
Probably the application still has some references to excel. How to make sure we remove all references to excel from the .net app?
Code:
Microsoft.Office.Interop.Excel.Application ExcelApp;
try
{
ExcelApp = (Microsoft.Office.Interop.Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
}
catch
{
ExcelApp = return new Microsoft.Office.Interop.Excel.Application();
}
ExcelApp.Visible = true;
ExcelApp.WindowState = XlWindowState.xlMaximized;
var wrkBooks = ExcelApp.Workbooks;
var wrkBook = wrkBooks.Open(fileName, 0, false, 5, "", "", false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
This works and opens the excel file for the user. However, when the user closes the excel file, excel.exe still remains in memory.
Probably the application still has some references to excel. How to make sure we remove all references to excel from the .net app?