If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
forcing a page break in a mail merge directory
Office Suite XP
Data in Excel I am creating a directory/catalog using Excel as my database. My data is sorted in alphabetical order, and my output is just the way I want it. What I would like to do is to force a page break when the first letter of a specific field changes. How can I accomplish this. I do not know any programming languages. Thank you, ~Alan |
#2
|
|||
|
|||
forcing a page break in a mail merge directory
Hi Alan,
If you have created the Directory in the form of a table, and the field containing the letter is in the first column of the table, the following macro should do what you want: ' Throw Away Macro created by Doug Robbins ' Dim source As Document, scat As Range, stab As Table, i As Long, Init As String Set source = ActiveDocument Set stab = source.Tables(1) Set scat = stab.Cell(1, 1).Range scat.End = scat.Start + 1 Init = scat.Text For i = 1 To stab.Rows.Count Set scat = stab.Cell(i, 1).Range scat.End = scat.Start + 1 If scat Init Then scat.ParagraphFormat.PageBreakBefore Init = scat.Text End If Next i If you did not create the directory as a table, it's easy enough to do, as all you have to do is insert one row table in the mailmerge main document and insert the mergefields into the cells of that one row table. Do not and anything after the table. Then when the merge is executed, a row will be created in the table for every record in the datasource. To see how to make use of the above macro, see the article “What do I do with macros sent to me by other newsgroup readers to help me out?” at: http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm -- Please post any further questions or followup to the newsgroups for the benefit of others who may be interested. Unsolicited questions forwarded directly to me will only be answered on a paid consulting basis. Hope this helps Doug Robbins - Word MVP "~~Alan~~" wrote in message ... Office Suite XP Data in Excel I am creating a directory/catalog using Excel as my database. My data is sorted in alphabetical order, and my output is just the way I want it. What I would like to do is to force a page break when the first letter of a specific field changes. How can I accomplish this. I do not know any programming languages. Thank you, ~Alan |
#3
|
|||
|
|||
forcing a page break in a mail merge directory
Hi ~~Alan~~,
An alternate method to the macro that Doug proposes would be to use a (relatively complex) set of nested fields. Normally, this approach is used to create one-to-many lists, but it can be applied just as well to what you want to do. See, for example, the KB article http://support.microsoft.com?kbid=211303 I am creating a directory/catalog using Excel as my database. My data is sorted in alphabetical order, and my output is just the way I want it. What I would like to do is to force a page break when the first letter of a specific field changes. How can I accomplish this. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
#4
|
|||
|
|||
forcing a page break in a mail merge directory
Thank you, I will give these a try.
Also, is there a way to keep a record from being broken between pages? ~Alan "~~Alan~~" wrote in message ... Office Suite XP Data in Excel I am creating a directory/catalog using Excel as my database. My data is sorted in alphabetical order, and my output is just the way I want it. What I would like to do is to force a page break when the first letter of a specific field changes. How can I accomplish this. I do not know any programming languages. Thank you, ~Alan |
#5
|
|||
|
|||
forcing a page break in a mail merge directory
Try applying the paragraph formatting "Keep lines together" attribute to the
paragraph containing the merge fields in the main document. -- Please post any further questions or followup to the newsgroups for the benefit of others who may be interested. Unsolicited questions forwarded directly to me will only be answered on a paid consulting basis. Hope this helps Doug Robbins - Word MVP "~~Alan~~" wrote in message ... Thank you, I will give these a try. Also, is there a way to keep a record from being broken between pages? ~Alan "~~Alan~~" wrote in message ... Office Suite XP Data in Excel I am creating a directory/catalog using Excel as my database. My data is sorted in alphabetical order, and my output is just the way I want it. What I would like to do is to force a page break when the first letter of a specific field changes. How can I accomplish this. I do not know any programming languages. Thank you, ~Alan |
Thread Tools | |
Display Modes | |
|
|