MS Access Mail Merge using Bookmarks to one Word document RRS feed

  • Question

  • I created a mail merge document and it works fine, the problem is that when it completes the merge it gives it to me in multiple word documents. How can I combine the end product into one large document? similar to a regular mail merge. This is my code.....

    ‘ Selects the template                                                                                                   
    LetterTempName = Fpath & "\PAS_Templates\" & "\"


    Set objword = New Word.Application

     Set objword = GetObject(, "word.Application")

        If Err = 429 Or 5151 Then

            Set objword = New Word.Application

            End If


    strSQL = "SELECT * FROM Letter_qry_ " _

        & "WHERE [ProjectID]=" & Me!ProjectID

    rstA.Open strSQL, CurrentProject.Connection, _

        adOpenStatic, adLockReadOnly


    With rstA

              Do Until .EOF


          With rstA

    strProject = Nz(.Fields("Project"))

      strLocation = Nz(.Fields("Location"))

      strFIRSTNAME = Nz(.Fields("FIRSTNAME"))

      strLASTNAME = Nz(.Fields("LASTNAME"))

       stre_mail = Nz(.Fields("E_mail"))


    End With


    With objword

                .Visible = True

                Set doc = .Documents.Add(LetterTempName)

                With doc.Bookmarks


    .Item("BmkProject_Number").Range.Text = strProject

    .Item("BmkLocation").Range.Text = strLocation

    .Item("BmkFIRSTNAME").Range.Text = strFIRSTNAME

    .Item("BmkLASTNAME").Range.Text = strLASTNAME

    .Item("BmkE_mail").Range.Text = stre_mail

    End With

    End With


    objword.PrintOut Background:=False

    objword.ActiveDocument.Close Savechanges:=wdDoNotSaveChanges





     objword.Quit Savechanges:=wdDoNotSaveChanges

    End With

    Set rst = Nothing

    Set doc = Nothing

    Set objword = Nothing


    Tuesday, January 18, 2011 3:45 PM


  • Hi County2

    The code you show us is not for mail merge. Mail merge is a particular functionality in Word and it would create all records in a single document. You should probably test it as an end-user in order to determine whether it meets your needs before you "reinvent the wheel"...

    If you're not familiar with Word's built-in mail merge and need assistance testing, please tell use which version of Office you're using.

    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Bessie Zhao Tuesday, January 25, 2011 11:40 AM
    Tuesday, January 18, 2011 3:54 PM