Basically I have a program written in C# which uses excel application.
While running my program, if the user tries to open any excel file, that file is opened on the excel instance created by my program.
I suppose this is related to the fact that excel opens on to existing instance of " Excel.exe ".
It causes zombie excel process when my program exits.
What I'd like to do is hide my excel instance from being used by user. (Or any other solution for the situation)
I tried to google something out but nothing so far.
My code looks like this.
foreach (string strFileName in this.m_ListRequestFileNames)
{
object misVal = System.Reflection.Missing.Value;
try
{
if (Common.IsOpened(strFileName) == true)
{
this.m_ParentWnd.Log(strFileName + " is in use by another program." + Environment.NewLine);
continue;
}
this.m_xlWBook = this.m_xlApp.Workbooks.Open(strFileName, 3, true, misVal, misVal, misVal, misVal, misVal, misVal, false, misVal, misVal, misVal, misVal, misVal);
if (Make(ref m_xlWBook, m_strDstPath, ref m_ListIgnoreSheetNames) != true)
{
this.m_ParentWnd.Log("-!- Error while making " + m_xlWBook.Name + " into a csv file" + Environment.NewLine);
continue;
}
this.m_ParentWnd.Log("Completed " + m_xlWBook.Name + Environment.NewLine);
}
catch (System.Exception e)
{
m_ParentWnd.Log(e.ToString());
}
this.m_xlWBook.Close(false, null, null);
}
this.m_xlApp.Quit();
Common.releaseObject(this.m_xlApp);