I'm running Excel from a C# .Net application and having trouble getting the process to shut down. How can I get the Excel process to shut down correctly from my C# program?
Try this:
foreach (System.Diagnostics.Process process in System.Diagnostics.Process.GetProcessesByName("EXCEL"))
{
if (process.MainModule.ModuleName.ToUpper().Equals("EXCEL.EXE"))
{
process.Kill();
break;
}
}