• opening word using code (Acc 97 sr2 on 95b)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » opening word using code (Acc 97 sr2 on 95b)

    Author
    Topic
    #368324

    I have a code that opens a word document and inserts values.

    The code first checks to see if word is open and then either uses it or opens it.

    If it opens it, it pops up as the front window, but if word is already open, it creates a document without bringing the window to the front.

    What bit of code needs to be added to make an existing background version of word become the open and active window?

    On Error Resume Next
    Set objWord = GetObject(, “Word.Application”)
    If Err.Number = 429 Then
    ‘Word is not running; creating a Word object
    Set objWord = CreateObject(“Word.Application”)
    Err.Clear
    End If

    ———-
    get values for fields here
    ———-

    objWord.Selection.WholeStory
    objWord.Selection.Fields.Update
    objWord.Selection.HomeKey Unit:=6
    objWord.Visible = True
    objWord.Activate

    Viewing 0 reply threads
    Author
    Replies
    • #576826

      I’ve got the answer

      objWord.windowstate = 0

      causes the window to open in the default size

      Just thought I would post the answer for interest sake

    Viewing 0 reply threads
    Reply To: opening word using code (Acc 97 sr2 on 95b)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: