Help Sort by Category with Table

S

Steve

I have used the below guidance to set up a mail merge to force a new
category to a new page, it work fine in the example for standard tab format.
However, I have six fields to pull data from (Excel File), two of the fields
contain long sentences (Title & Resolution Action). So I need to use a
table to hold the data in columns or it just runs wild on the page. I can
make it work for directory as a single list but I am at a loss to make it
page break for new categories. Is it possible to use a table format and
page break on categories?

Steve

«Action_ID»
«Title»
«Planned_Start_Date»
«Planned_Finish_Date»
«Percent_Complete» %
«Resolution_Action»



Microsoft Knowledge Base Article - 211303
HOW TO: Use Mail Merge to Create a List Sorted by Category in Word 2000

City Employee Sales
Atlanta Smith $3,000
Atlanta Gates $50,000
Atlanta Henderson $10,000
Houston Jones $8,000
Houston Kelley $9,000
Houston Peterson $0



Force Each New Category to a New Page
{ If { MERGESEQ } = "1" "{ MERGEFIELD City }" ""}<ENTER>
{ SET Place1 { MERGEFIELD City }}<ENTER>
{ If { Place2 } <> { Place1 }"<ENTER>
----------------------------Page Break--------------------------------
{ MERGEFIELD City }<ENTER>
<ENTER>
{ MERGEFIELD Employee }{ MERGEFIELD Sales }" "{ MERGEFIELD Employee }{
MERGEFIELD Sales }" }{ SET Place2 { MERGEFIELD City }}<ENTER>

Atlanta

Smith $3,000
Gates $50,000
Henderson $10,000

----------------------------Page Break-----------------------------
Houston

Jones $8,000
Kelley $9,000
Peterson $0
 
D

Doug Robbins

I am not sure exactly what you want, but if you execute the merge to catalog
type document then run the following macro, it might produce it:

' Macro to create multiple items per condition 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.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
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top