Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    York, Pennsylvania, USA
    Posts
    164
    Thanks
    0
    Thanked 3 Times in 2 Posts

    Word from Access (Access 2002)

    We've got an Access programmer here who's launching Word from Access to do a mail merge with the current Access record. She's using a shell command to launch Word and a template. This works fine except when the user forgets to close Word and wants to merge another document. Access opens yet another session of Word.

    Is there a way on the Access side to detect if another session of Word is open and perhaps using that session rather than starting a new session?

    TIA

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word from Access (Access 2002)

    GetObject and CreateObject are the best ways to do this:

    Dim objWord As Object
    On Error Resume Next
    Set objWord = GetObject(, "Word.Application")
    If objWord Is Nothing Then
    Set objWord = CreateObject("Word.Application")
    If objWord Is Nothing Then
    MsgBox "Failed to open Word"
    Exit Sub
    End If
    End If
    On Error GoTo 0 ' or to your error handler
    objWord.Visible = True
    objWord.Activate

  3. #3
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    York, Pennsylvania, USA
    Posts
    164
    Thanks
    0
    Thanked 3 Times in 2 Posts

    Re: Word from Access (Access 2002)

    Thanks, Hans. Will give it a go.

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Word from Access (Access 2002)

    You might also want to have you programmer take a look at our basic Automation tutorial.
    Wendell

  5. #5
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    York, Pennsylvania, USA
    Posts
    164
    Thanks
    0
    Thanked 3 Times in 2 Posts

    Re: Word from Access (Access 2002)

    Very nice and informative site. Thanks, Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •