PC Review


Reply
Thread Tools Rate Thread

C# Word application problem

 
 
Jason Huang
Guest
Posts: n/a
 
      26th Jul 2006
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


 
Reply With Quote
 
 
 
 
AAJ
Guest
Posts: n/a
 
      26th Jul 2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interesting flickering problem if application's user control is invalidated by external application (e.g. Notepad) sasifiqbal@gmail.com Microsoft C# .NET 2 27th Apr 2006 05:58 PM
'Type Mismatch' exception when calling Word.Application.Documents.Open method in Office (Word) 2003 PIA from C# webstuff@urbanperspective.net Microsoft C# .NET 1 18th Oct 2005 05:37 PM
Problem with Normal.dot while opening a word application in vb.ne =?Utf-8?B?QWx0b19jaG4=?= Microsoft VB .NET 0 7th Feb 2005 08:43 AM
Problem with an application in Microsoft Word judy bazan Microsoft Word New Users 1 10th Oct 2003 10:12 PM
How to Access Word active object on other application and Get the word's Document FilePath? Lex Yacc Microsoft C# .NET 0 20th Aug 2003 04:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:59 PM.