How to bring a window of another document to the front


  • Hello!

    I have a form in a document, wherewith i should open another .doc file, and manipulate the text in it, and when i have finished, i should close that file but that one, which contains the form i should not. I made almost 99% of the code, and its working, but i cannot bring the window of the other document from the code into the front.  I open the file in the forms initialize method and i set it immediately active, but thats not enough, even the AppActivate("Title") method isnt seem to work, the focus remains on the window which contains the form, and the form doesnt appear in the opened window, so i cannot see nothing from the text manipulation. 
    How can i bring it to the front, to see what gets changed in the opened document?

    Tuesday, January 05, 2010 7:56 PM


All replies

  • Hi VinoBob,

    i have taken a look and it seems that Word doesn't have the functionality to bring to front unless you use API. There are various examples if you google 'bring word application to front'
    Friday, January 08, 2010 8:14 AM
  • Hello,

    We'll be able to use Windows API SetWindowPos function to bring a window to the front, you could get started with this sample:


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Tim Li Tuesday, January 12, 2010 5:48 AM
    Tuesday, January 12, 2010 5:48 AM