How to programmatically bring a Word window to front? - DOTNET

This is a discussion on How to programmatically bring a Word window to front? - DOTNET ; Hello, friends, In c#.net 2005, we have the following source, hoping to bring a Word window to front. However, it does not work. Any ideas? How to bring a Word window to front? Thanks a lot. ------------------- source code foreach ...

+ Reply to Thread
Results 1 to 2 of 2

How to programmatically bring a Word window to front?

  1. Default How to programmatically bring a Word window to front?

    Hello, friends,

    In c#.net 2005, we have the following source, hoping to bring a Word window
    to front. However, it does not work.

    Any ideas? How to bring a Word window to front?

    Thanks a lot.

    ------------------- source code

    foreach (Microsoft.Office.Interop.Word.Document doc in this.wordApp.Documents)
    {
    if (String.Compare(doc.Path + "\\" + doc.Name, fullPathFileName, true)
    == 0)
    {
    doc.Activate();
    return;
    }
    }



  2. Default Re: How to programmatically bring a Word window to front?

    I don't believe you can bring the document to the foreground with
    doc.Activate() call, only make it the active document. You should call
    this.wordApp.Activate() after doc.Activate() to bring the Word window to
    the foreground.

    Robert

    Andrew wrote:
    > Hello, friends,
    >
    > In c#.net 2005, we have the following source, hoping to bring a Word window
    > to front. However, it does not work.
    >
    > Any ideas? How to bring a Word window to front?
    >
    > Thanks a lot.
    >
    > ------------------- source code
    >
    > foreach (Microsoft.Office.Interop.Word.Document doc in this.wordApp.Documents)
    > {
    > if (String.Compare(doc.Path + "\\" + doc.Name, fullPathFileName, true)
    > == 0)
    > {
    > doc.Activate();
    > return;
    > }
    > }
    >
    >


+ Reply to Thread