Reply
 
Thread Tools Display Modes
  #1   Report Post  
aps
 
Posts: n/a
Default Mail Merge with variable lines per page

I need to perform a mail merge of customers where each customer has a
variable number of projects. For each customer I need a new page, but I need
to put each project of the merge into a table on the customer page. This
table will vary in length according to how many projects the customer has.

I can put the data in any format, it currently resides in an Access
database. I'm using windows 2000.

Thanks for any help on this.

Arthur

  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

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

See the "Group Multiple items for a single condition" item on fellow MVP
Cindy Meister's website at

http://homepage.swissonline.ch/cindy...faq1.htm#DBPic

Or take a look at the following Knowledge Base Article

How to Work Around Duplicate Names in Mail Merge Data

http://support.microsoft.com/default...b;en-us;302665



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



--
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
"aps" wrote in message
...
I need to perform a mail merge of customers where each customer has a
variable number of projects. For each customer I need a new page, but I
need
to put each project of the merge into a table on the customer page. This
table will vary in length according to how many projects the customer has.

I can put the data in any format, it currently resides in an Access
database. I'm using windows 2000.

Thanks for any help on this.

Arthur



  #3   Report Post  
aps
 
Posts: n/a
Default

Hi Doug,

Thanks for the help. It gives me plenty of scope to solve the problem.

Cheers.

"Doug Robbins" wrote:

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

See the "Group Multiple items for a single condition" item on fellow MVP
Cindy Meister's website at

http://homepage.swissonline.ch/cindy...faq1.htm#DBPic

Or take a look at the following Knowledge Base Article

How to Work Around Duplicate Names in Mail Merge Data

http://support.microsoft.com/default...b;en-us;302665



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



--
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
"aps" wrote in message
...
I need to perform a mail merge of customers where each customer has a
variable number of projects. For each customer I need a new page, but I
need
to put each project of the merge into a table on the customer page. This
table will vary in length according to how many projects the customer has.

I can put the data in any format, it currently resides in an Access
database. I'm using windows 2000.

Thanks for any help on this.

Arthur




  #4   Report Post  
 
Posts: n/a
Default

Hi Arthur,

You might want to consider an alternate that includes Mail Merge, and
accesses your database to output customer specific documents (PDF and Print)
for distribution (e-mail, web posting, and of course print out). My
software, OctoTools is a commercial package that is designed for automated
processing of the types of output you are looking for. Although it is not
justified for desk-top low volume, it is just the ticket for your production
jobs. If you are looking to process from 10 to 10,000 per day and looking
for an automated approach, please call me (978) 535-7676 or e-mail to
discuss your application further. Thank you for your time.

Larry T.
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
i need to mail merge name tags,keeps makng 1 page with same name travelguy13 Mailmerge 1 July 30th 05 04:51 PM
How do I use mail merge in word to get a page of labels, each wit. lpedlar Mailmerge 2 April 11th 05 01:52 AM
Mail Merge with Multi Doc's on one page Lisa Microsoft Word Help 7 April 6th 05 03:49 PM
How do I setup first page header/footer when using mail merge? Intravler Mailmerge 3 March 2nd 05 12:07 AM
bringing mail merge recipients box to front of page Bandit Mailmerge 0 January 7th 05 06:07 PM


All times are GMT +1. The time now is 08:11 AM.

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"