471,319 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Creating more Winword processes

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.

Feb 1 '06 #1
1 1680
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
;)

"Paguro Bernardo" wrote:
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.

Feb 2 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.