Stop Word Application programmatically
-
I have a process that starts and runs MS Word for about 10 seconds. Sometimes Word seems to hang; it stays open for 'ever'. Is there an way that I can run a process2 independently of process that checks to see if Word is running and if it is, if it has been open for about a minute, and if it has, to stop it? Thanks in advance.
-
I have a process that starts and runs MS Word for about 10 seconds. Sometimes Word seems to hang; it stays open for 'ever'. Is there an way that I can run a process2 independently of process that checks to see if Word is running and if it is, if it has been open for about a minute, and if it has, to stop it? Thanks in advance.
You can do the following. Run the follong code to see if MS Word is running and if it is it will kill the process. using System.Diagnostics; private Process[] WordProcessList; ..... int index; WordProcessList = Process.GetProcessesByName("WINWORD"); for( index = 0; index < WordProcessList.Length; index++) { WordProcessList[index].Kill(); }