Hi Jason
I'm not sure if this is any help, but I use the following for checking if
anything outside my app has opened excel. Perhaps you can modify it?
using System.Diagnostics;
Process[] myProcesses;
// Returns array containing all instances of Excel.
myProcesses = Process.GetProcessesByName("Excel");
int kill = 0;
if(myProcesses.Length >0)
{
if (MessageBox.Show ("Excel is running. Continuing will close Excel and all
work will be lost. Continue ? ", "Close Excel", MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation) == DialogResult.Yes)
{
if (MessageBox.Show ("All work will be lost. Sure ? ", "Close Excel",
MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
{
kill = 1;
}
}
if (kill == 1)
{
foreach(Process myProcess in myProcesses)
{
myProcess.Kill();
kill = 0;
}
}
}
Hope it helps
Andy
"Jason Huang" <Ja************@hotmail.comwrote in message
news:e9**************@TK2MSFTNGP04.phx.gbl...
Hi,
In my C# Windows form project, I would like to verify if a Word
application (Word.ApplicationClass myWordApp) is not closed.
What would the If statement be?
Thanks for help.
Jason