Creating more Winword processes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paguro Bernardo

    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(o bject sender, System.EventArg s e)
    {
    Word.Applicatio nClass w1 = new Word.Applicatio nClass();
    w1.Visible = true;
    Word.Applicatio nClass w2 = new Word.Applicatio nClass();
    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.

  • jocool

    #2
    RE: Creating more Winword processes

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

    add this just after your code
    w2.DisplayAlert s = False;

    all errors should be hidden
    ;)

    "Paguro Bernardo" wrote:
    [color=blue]
    > 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(o bject sender, System.EventArg s e)
    > {
    > Word.Applicatio nClass w1 = new Word.Applicatio nClass();
    > w1.Visible = true;
    > Word.Applicatio nClass w2 = new Word.Applicatio nClass();
    > 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.
    >
    >[/color]

    Comment

    Working...