• Mailmerge list in Word 97 (Win 95, Word 97 SR2)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Mailmerge list in Word 97 (Win 95, Word 97 SR2)

    Author
    Topic
    #367324

    I am mailmerging a form letter from an Access query.

    The query lists a name and address and then a list of manuals held by that person.

    The letter tells them what manuals they hold.

    My problem is getting the list of manuals to print on the one page. The name and adress goes in okay and then the first manual title. To get the next manual title I put a field in but this forces a section page break and the whole letter is reproduced with the 2nd manual title. A letter is produced for each manual title.

    How can I get all the records to print on the one page?

    David

    Viewing 0 reply threads
    Author
    Replies
    • #572444

      David,
      I believe the problem is more Access-related than Word-related.

      Each row in an Access query or table is the equivalent of a new record, and the command will force each new row to create a new letter. Try setting up a query that will put all of the info for one person into one row. Then each row is a complete record, and your merge should work.

      In your database, do you have separate fields for each manual? If so, you wouldn’t have to use . You’d just put in the field names. If the fields are blank in Access, they’ll be blank after the merge (unless you specify otherwise using the conditional statements).

      You might try posting this question in the Access forum. Good luck!

      • #572591

        Ann,

        Fixed it, although it seems a bit of a fudge.

        I discovered a DATABASE toolbar lurking at the top of the screen and used that instead. I abandoned mailmerge and inserted the data as fields. It meant I had to have 3 queries that each held just the information I required (addressee, employee concerned & list of manuals) but each query only has to have a number entered in it so it’s not too onerous.

        But it works!

        Thank you for your help,

        David

        • #572945

          Hi Solomon:
          The database toolbar is one way to go. You can also use mailmerge with a combination of IF & SET fields. Take a look at the following MS KB article:

          http://support.microsoft.com/default.aspx?…b;EN-US;Q105888%5B/url%5D

          Cheers,

          • #573681

            Phil,

            I tried to use the mergefield technique but rapidly became confused with nested fields. In the end I discovered the catalog merge (courtesy of a Cindy Meister web article) and did a double mailmerge to produce the required doc. I have automated it with a macro.

            The macro is listed below in case anybody else is interested. Half of it is recorded and other half my own scripting so I imagine it can be cleaned up a lot by someone who knows VBA. However, it’s quick and it works. I can now generate the letters off a toolbar button.

            Example finished page attached.

            Thanks to everybody for their tips.

            David

            Sub leavers_letter()

            ‘Open 1st doc in mailmerge catalogue mode

            ChangeFileOpenDirectory “D:ManualsSYSTEMSaccess forms”
            Documents.Open FileName:=”””test leavers.doc”””

            ‘New doc generated from merge

            With ActiveDocument.MailMerge
            .Destination = wdSendToNewDocument
            .Execute
            End With

            ‘Header row added to table in new doc

            Selection.GoTo What:=Cell, Name:=”a1″
            Selection.InsertRows (1)
            Selection.GoTo What:=Cell, Name:=”a1″
            Selection.TypeText Text:=”System ID”
            Selection.MoveRight Unit:=wdCharacter, count:=1
            Selection.TypeText Text:=”Title”
            Selection.MoveRight Unit:=wdCharacter, count:=1
            Selection.TypeText Text:=”Copy”

            Selection.GoTo What:=Cell, Name:=”a1″
            Selection.SelectRow
            Selection.Font.Bold = wdToggle
            Selection.Rows.HeadingFormat = wdToggle

            ‘Cursor moved out of table to top of doc

            Selection.GoTo What:=Cell, Name:=”a1″
            Selection.SplitTable
            Selection.TypeParagraph
            Selection.TypeParagraph
            Selection.MoveUp Unit:=wdLine, count:=2
            Selection.TypeText Text:=”To:”
            Selection.MoveDown Unit:=wdLine, count:=1

            ‘New doc merged again to add addressee etc fields

            ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
            ActiveDocument.MailMerge.OpenDataSource Name:= _
            “SW-0101976NINA DAccessDataDOCUMENT.MDB”, ConfirmConversions:=False _
            , ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
            PasswordDocument:=””, PasswordTemplate:=””, WritePasswordDocument:=””, _
            WritePasswordTemplate:=””, Revert:=False, Format:=wdOpenFormatAuto, _
            Connection:=”QUERY Leavers Letter”, SQLStatement:= _
            “SELECT * FROM [Leavers Letter]”, SQLStatement1:=””
            ActiveDocument.MailMerge.EditMainDocument
            ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
            “employees_1First_Name”
            Selection.TypeText Text:=” ”
            ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
            “employees_1Last_Name”
            Selection.TypeParagraph
            ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
            “Dept_Name”
            Selection.TypeParagraph
            ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
            “Location_3Location”
            Selection.TypeParagraph
            Selection.TypeParagraph
            ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
            “employeesFirst_Name”
            Selection.TypeText Text:=” ”
            ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
            “employeesLast_Name”
            Selection.TypeParagraph

            ‘Letter text added

            Selection.TypeText Text:= _
            “Document Control have been informed that the above employee ”
            Selection.TypeText Text:= _
            “has left the company. The documents issued to the above are ”
            Selection.TypeText Text:=”listed below.”
            Selection.TypeParagraph
            Selection.TypeParagraph
            Selection.TypeText Text:= _
            “Document Control would appreciate the return of these docume”
            Selection.TypeText Text:=”nts.”

            ‘ Mailmerged to form complete letter

            With ActiveDocument.MailMerge
            .Destination = wdSendToNewDocument
            .Execute
            End With

            ‘Merge will produce as many letters as there are records in the query.
            ‘Cursor set to start of page 2 and remaing doc selected

            ‘count pages
            Dim intpage As Integer

            ActiveDocument.Repaginate
            intpage = ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)
            ‘MsgBox ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)

            ‘if more than 1 page go to page 2
            If intpage > 1 Then

            Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, count:=2, Name:=””
            Selection.Find.ClearFormatting
            With Selection.Find
            .Text = “page”
            .Replacement.Text = ” ”
            .Forward = True
            .Wrap = wdFindContinue
            .Format = False
            .MatchCase = False
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
            End With

            ‘if only 1 page exit sub
            Else
            Exit Sub

            End If

            ‘Selected text deleted

            Selection.EndKey Unit:=wdStory, Extend:=wdExtend
            Selection.delete Unit:=wdCharacter, count:=1
            ActiveWindow.ActivePane.SmallScroll Down:=-24
            Selection.TypeBackspace

            ‘Backspace to delete new page section break
            ‘single page letter remaining

            Selection.delete Unit:=wdCharacter, count:=1

            End Sub

    Viewing 0 reply threads
    Reply To: Mailmerge list in Word 97 (Win 95, Word 97 SR2)

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

    Your information: