Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Erick Erick is offline
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mail merge - different line of address on a separate line lucylou Microsoft Word Help 3 December 12th 06 10:32 AM
Automated mail merge of catalog/directory inserts page breaks Tim Mailmerge 2 July 28th 06 07:45 PM
Setting tab stops in Mail Merge for a Catalog/phone list monika Microsoft Word Help 0 July 10th 06 02:19 PM
merge a catalog Doug Robbins - Word MVP Mailmerge 0 March 26th 06 11:47 PM
Insert a document into a mail merge &merge to electronic mail Alex James Mailmerge 1 October 7th 05 09:41 PM


All times are GMT +1. The time now is 06:44 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"