Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Insert line into catalog mail merge
I have set up a catalog mail merge in Word 2000 from an Excel worksheet. One
of the fields is a date and I have sorted on that. Is there any way to get Word to automatically put a line between any two rows where the date changes? Ideally I mean a solid line, but an empty row would do. So record1 1 May 2007 record2 1 May 2007 record3 2 May 2007 etc would become something like record1 1 May 2007 record2 1 May 2007 ----------------------- record3 2 May 2007 etc Thanks, Eric |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Insert line into catalog mail merge
You could modify the following macro to do that:
' 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 -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "EricK" wrote in message ... I have set up a catalog mail merge in Word 2000 from an Excel worksheet. One of the fields is a date and I have sorted on that. Is there any way to get Word to automatically put a line between any two rows where the date changes? Ideally I mean a solid line, but an empty row would do. So record1 1 May 2007 record2 1 May 2007 record3 2 May 2007 etc would become something like record1 1 May 2007 record2 1 May 2007 ----------------------- record3 2 May 2007 etc Thanks, Eric |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
mail merge - different line of address on a separate line | Microsoft Word Help | |||
Automated mail merge of catalog/directory inserts page breaks | Mailmerge | |||
Setting tab stops in Mail Merge for a Catalog/phone list | Microsoft Word Help | |||
merge a catalog | Mailmerge | |||
Insert a document into a mail merge &merge to electronic mail | Mailmerge |