Re: Can Word consolidate records for a mail merged fax request?

From: Doug Robbins (dkr_at_NOmvpsSPAM.org)
Date: 10/09/04


Date: Fri, 8 Oct 2004 21:34:49 -0400

Word does not really have the ability to perform a "multiple items per
condition (=key field)" mailmerge.

See the "Multiple items per condition" item under the "Special merges"
section of fellow MVP Cindy Meister's website at

http://homepage.swissonline.ch/cindymeister/MergFram.htm

Or, if you create a Catalog (on in Word XP and later, it's called Directory)
type mailmerge main document with the mergefields in the cells of a one row
table in the mailmerge main document with the keyfield in the first cell in
the row and then execute that merge to a new document and then run the
following macro, it will create separate tables with the records for each
key field in them. With a bit of further development, you may be able to
get it to do what you want. For example, you could execute another merge to
produce a document that contained the vendor name, introduction and closing
part of the fax and then run a macro to grab each table out of the document
produced by the following macro and insert it into the desired place in each
Section of the second merged document.

' Macro to create multiple items per condition in separate tables from a
directory type mailmerge

Dim source As Document, target As Document, scat As Range, tcat As Range
Dim data As Range, stab As Table, ttab As Table
Dim i As Long, j As Long, k As Long, n As Long
Set source = ActiveDocument
Set target = Documents.Add
Set stab = source.Tables(1)
k = stab.Columns.Count
Set ttab = target.Tables.Add(Range:=Selection.Range, numrows:=1,
numcolumns:=k - 1)
Set scat = stab.Cell(1, 1).Range
scat.End = scat.End - 1
ttab.Cell(1, 1).Range = scat
j = ttab.Rows.Count
For i = 1 To stab.Rows.Count
    Set tcat = ttab.Cell(j, 1).Range
    tcat.End = tcat.End - 1
    Set scat = stab.Cell(i, 1).Range
    scat.End = scat.End - 1
    If scat <> tcat Then
        ttab.Rows.Add
        j = ttab.Rows.Count
        ttab.Cell(j, 1).Range = scat
        ttab.Cell(j, 1).Range.Paragraphs(1).PageBreakBefore = True
        ttab.Rows.Add
        ttab.Cell(j + 1, 1).Range.Paragraphs(1).PageBreakBefore = False
        For n = 2 To k
            Set data = stab.Cell(i, n).Range
            data.End = data.End - 1
            ttab.Cell(ttab.Rows.Count, n - 1).Range = data
        Next n
    Else
        ttab.Rows.Add
        For n = 2 To k
            Set data = stab.Cell(i, n).Range
            data.End = data.End - 1
            ttab.Cell(ttab.Rows.Count, n - 1).Range = data
        Next n
    End If
Next i

-- 
Please respond to the Newsgroup for the benefit of others who may be 
interested.   Questions sent directly to me will only be answered on a paid 
consulting basis.
Hope this helps,
Doug Robbins - Word MVP
"Pierre" <cowguy@aol.com> wrote in message 
news:c00fad31.0410080946.410d80f1@posting.google.com...
> Using Word XP, and database is in Excel.
> Would like to send to our suppliers via fax, requests for quotation
> for various parts that we buy.  Each item in the database is
> identified by a vendor name, fax number, and part number etc.
>
> How may we send each supplier on the list a request for quote which
> includes all the items for which that particular vendor has been
> assigned?  (Would like one page per vendor, with just that vendors'
> parts listed on the page.)
>
> Have merged successfully but with each item on a separate page, and
> would like to get away from all that paper.
>
> TIA for any assistance.
>
> Peter 


Relevant Pages

  • Re: Merge Multiple Records into One Document
    ... Word does not really have the ability to perform a "multiple items per ... type mailmerge main document with the mergefields in the cells of a one row ... Set scat = stab.Cell.Range ... Some donors have given multiple times over the year, I> want their letter to list all their donations (I could just send them a> separate letter for each donation, but that would be inefficient and not> as ...
    (microsoft.public.word.mailmerge.fields)
  • Re: mail merge without Access
    ... Word does not really have the ability to perform a "multiple items per ... section of fellow MVP Cindy Meister's website at ... type mailmerge main document with the mergefields in the cells of a one row ... Set scat = stab.Cell.Range ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Mail Merge - Next Record If Statement
    ... Sounds like you are trying to create a multiple items per condition type ... type mailmerge main document with the mergefields in the cells of a one row ... Set scat = stab.Cell.Range ...
    (microsoft.public.word.mailmerge.fields)
  • Re: How do I set merge fields in headers?
    ... field)" mailmerge, which Word does not really have the ability to perform. ... See the "Group Multiple items for a single condition" item on fellow MVP ... Dim source As Document, target As Document, scat As Range, tcat As Range ... > each of the records) in the header, that would over come the problems. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Arbitrary number of rows in a table
    ... See the "Group Multiple items for a single condition" item on fellow MVP ... type mailmerge main document with the mergefields in the cells of a one row ... key field in them. ... Dim source As Document, target As Document, scat As Range, tcat As Range ...
    (microsoft.public.word.mailmerge.fields)