How Programmatically Open a Window Normal Size? RRS feed

  • Question

  • I'm programming Word via Visual FoxPro, and I have the process working except that the document always appears in the task bar instead of being opened where the user can see it, and users typically want to know what happened to it. The code I'm trying at present is (after #DEFINE-ing WdWindowStateMaximize = 1):

        oWord.Documents.Open( sDoc, 0, 1 )
        oWord.ActiveDocument.ActiveWindow.WindowState = wdWindowStateMaximize

    This works in the sense that, when the user clicks the icon in the task bar, the window does open maximized. But what I want is for it to simply appear that way instead of only in the task bar. No parm in the Open command seems to cover this.

    Thanks for your help.


    Thursday, October 31, 2013 4:15 PM

All replies

  • I don't know Visual FoxPro so I can't help you with the exact command. However, in VBA it would look like this...

    Dim doc as Word.Document
    Set doc = Documents.Open fileName:="Your Path and Name"
    doc.ActiveWindow.WindowState = wdWindowStateMaximize

    Kind Regards, Rich ...

    Thursday, October 31, 2013 10:56 PM
  • I have just discovered that the Word windows were opening in the requested size after all (I specified 'normal' in the title of this post but switched to 'maximize' just for testing purposes).

    The problem is they were opening behind my main Visual FoxPro (VFP) window, which was full screen. So what I need is a way to force them to open on top of the main VFP window. I can find no such property in the MSDN documentation, and an internet search has so far found none that seems promising although several people claim to have one. (One such site is flagged as malware by my security program).

    Is there any solution to this?


    • Edited by Petun Tahd Saturday, November 2, 2013 6:31 PM
    Saturday, November 2, 2013 6:31 PM