Breaking News

How to close Excel CSV format files

Q:


How to close Excel CSV format files if anyone have idea please share it. From application it is opening with csv format file but i need to close every time, i have tried using close all instances from MSExcel vbo but did not work
A:
I wound up making an Extended Environment object to handle this for other uses. Set it to C# and add System.Diagnostics. 
Use the below in a code stage, where "proc" should be the process name you're trying to kill.
foreach(Process p in Process.GetProcesses())
{
    if (p.ProcessName.ToLower().Equals(proc.ToLower()))
        p.Kill();
}

No comments