Creating more Winword processes

  • Thread starter Paguro Bernardo
  • Start date
P

Paguro Bernardo

Hi everybody,

I'm encountering some problem in trying to activate more than one
instance of Word from C#.
To keep it simple, I have a stupid Form, with just a button in it and
the following code:

private void button1_Click(object sender, System.EventArgs e)
{
Word.ApplicationClass w1 = new Word.ApplicationClass();
w1.Visible = true;
Word.ApplicationClass w2 = new Word.ApplicationClass();
w2.Visible = true;
}

When I click on the button I end up (as expected) with two winword
processes in the task manager, and two word windows on the screen.
But when I try to close the second Word, a MessageBox appears telling
me that Normal.dot is used by another user or application. When I press
OK a FilDialog appears asking me for a name to save the Normal.dot. I
press Cancel in this Dialog and nothing happens. If I try again to
close Word, another Dialog appears, stating that Normal.dot has been
modified and asking me if I want to save it. When I say No, Word
finally agrees to close.

Can you explain this strange (at least to me) behavior?

Thank you so much,
Francesco.
 
G

Guest

hello, i can't explain it but i maybe have a solution :

add this just after your code
w2.DisplayAlerts = False;

all errors should be hidden
;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top