I have to 2 process excel. For example:
1) example1.xlsx 2) example2.xlsx
How to kill first \"example1.xlsx\"?
I use this code:
f
You need to check file handles, that are opened by process and then kill it.
How to check which file handles process is holding: How do I get the list of open file handles by process in C#?
foreach (Process clsProcess in Process.GetProcesses())
{
if (clsProcess.ProcessName.Equals("EXCEL") && HasFileHandle(fileName, clsProcess))
{
clsProcess.Kill();
break;
}
}