Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / July 2004

Tip: Looking for answers? Try searching our database.

Help Sort by Category with Table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 28 Jul 2004 17:09 GMT
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
Doug Robbins - 29 Jul 2004 03:14 GMT
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

Signature

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

>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
[quoted text clipped - 49 lines]
> Kelley $9,000
> Peterson $0

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.