Is it ok to Kill EXCEL.exe in C#.?

Posted by Pramodmca09 under C# on 11/18/2009 | Views : 3679 | Status : [Member] | Replies : 1
I'm reading excel file usgin COM object. but after runng code EXCEL.exe remains in process queqe. So I'm using
 System.Diagnostics. Process[] excelProcesses = System.Diagnostics.Process.GetProcessesByName("EXCEL"); 
foreach(System.Diagnostics.Process p in excelProcesses)
to kill EXCEL.exe process Is this ok to use.

If no then why shold not?


Posted by: Lakhangarg on: 11/19/2009 [Member] [Moderator] Silver

above code will close all the instance of Excel. to close your own instance you need to get the process Id when you will start reading means creating instance of excel to communicate. then you can stop that process only.

Thanks & Regards
Lakhan Pal Garg

Pramodmca09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response