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/cindy...r/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.
' 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
"Ken Le Gall" wrote in message
...
Hi
I have to create a catalogue of our products which is held in MS Excel,
now
I have done mail merging before and thats ok but I am getting stuck on the
following issue.
My data in Excel looks like this (there are loads of other fields but not
necessary here).:
308 14 Pink
308 15 Turquoise
311 08 Purple
311 09 Brown
311 16 Light Pink
311 18 Lt. Green
311 34 Black/White
327 04 Orange
327 06 Green
327 14 Pink
What I would like to do is have one record for all the 308, 311 and 327
like
this:
Record 1
This is my description for this Inventory
30814 Pink
30815 Turquoise
End Record
Record 2
This is my description for this Inventory
etc..etc...etc...
Can someone help this poor newbie, before I pull whats left of my hair
out.
Many Thanks in advance.
Ken.