Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
LISTNUM in Mailmerge IF disconnected from other LISTNUMs
I am using Mailmerge to extract a series of lists from an Excel spreadsheet.
The top of each list starts a new page and adds a column header - that works using {IF ...}. I want to reset the LISTNUM at the time, but the list numbers in the header (within the IF) restart themselves with 1. each time, and \s 0 has no influence on the LISTNUMs in the main list (outside the IF). Can someone explain this? Is there a workaround? Is there a better way? (I hope) Thanks |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
LISTNUM in Mailmerge IF disconnected from other LISTNUMs
Give us an idea of the data that you are starting with and how you want the
output to appear. -- 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 "Wm B." Wm wrote in message ... I am using Mailmerge to extract a series of lists from an Excel spreadsheet. The top of each list starts a new page and adds a column header - that works using {IF ...}. I want to reset the LISTNUM at the time, but the list numbers in the header (within the IF) restart themselves with 1. each time, and \s 0 has no influence on the LISTNUMs in the main list (outside the IF). Can someone explain this? Is there a workaround? Is there a better way? (I hope) Thanks |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
LISTNUM in Mailmerge IF disconnected from other LISTNUMs
OK, the real data structures are way too complicated to explain here, but I
can gin up an exemplar: Excel spreadsheet has 3 columns: Name, Company, Earnings, sorted by Company/Earnings/Name. Word doc imports the data, and prints it in columns with Corporate header/footer. Every time the Company changes a new page is generated, along with 2 lines of column headings. The entries for one Company can use several pages. The Column head is not repeated per page (next version - one Company rarely, if ever, spans pages). This is done by saving the previous value of Company and using {IF (OLD = NEW), ...} to insert the headers if it changes. This works! Problem: I want to put serial numbers (ie: ranking) on the individual lines, and restart them from '1' with each new Company page. Solution: put LISTNUM /s 0 in the column heading. Clever, but it doesn't work! Investigation: I put several LISTNUM entries in the column header. With each new header (execution of the LISTNUM /s 0 inside the IF), the LISTNUM increments as expected. The LISTNUM for the lines outside the IF are NOT reset. Open to ideas, suggestions, and thoughtful WAG's. --- "Doug Robbins - Word MVP" wrote: Give us an idea of the data that you are starting with and how you want the output to appear. -- 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 "Wm B." Wm wrote in message ... I am using Mailmerge to extract a series of lists from an Excel spreadsheet. The top of each list starts a new page and adds a column header - that works using {IF ...}. I want to reset the LISTNUM at the time, but the list numbers in the header (within the IF) restart themselves with 1. each time, and \s 0 has no influence on the LISTNUMs in the main list (outside the IF). Can someone explain this? Is there a workaround? Is there a better way? (I hope) Thanks |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
LISTNUM in Mailmerge IF disconnected from other LISTNUMs
I would think that the following macro could be modified to do what you
want: 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 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 "Wm B." wrote in message news OK, the real data structures are way too complicated to explain here, but I can gin up an exemplar: Excel spreadsheet has 3 columns: Name, Company, Earnings, sorted by Company/Earnings/Name. Word doc imports the data, and prints it in columns with Corporate header/footer. Every time the Company changes a new page is generated, along with 2 lines of column headings. The entries for one Company can use several pages. The Column head is not repeated per page (next version - one Company rarely, if ever, spans pages). This is done by saving the previous value of Company and using {IF (OLD = NEW), ...} to insert the headers if it changes. This works! Problem: I want to put serial numbers (ie: ranking) on the individual lines, and restart them from '1' with each new Company page. Solution: put LISTNUM /s 0 in the column heading. Clever, but it doesn't work! Investigation: I put several LISTNUM entries in the column header. With each new header (execution of the LISTNUM /s 0 inside the IF), the LISTNUM increments as expected. The LISTNUM for the lines outside the IF are NOT reset. Open to ideas, suggestions, and thoughtful WAG's. --- "Doug Robbins - Word MVP" wrote: Give us an idea of the data that you are starting with and how you want the output to appear. -- 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 "Wm B." Wm wrote in message ... I am using Mailmerge to extract a series of lists from an Excel spreadsheet. The top of each list starts a new page and adds a column header - that works using {IF ...}. I want to reset the LISTNUM at the time, but the list numbers in the header (within the IF) restart themselves with 1. each time, and \s 0 has no influence on the LISTNUMs in the main list (outside the IF). Can someone explain this? Is there a workaround? Is there a better way? (I hope) Thanks |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Tabs disconnected from bullets | Page Layout | |||
tabs disconnected from bullets | Page Layout | |||
Word Document open delay caused by disconnected template. | Microsoft Word Help | |||
LISTNUMs disappear when I select Heading 2 | Page Layout | |||
Somebody please help me understand Listnums and Cross-references! | Page Layout |