Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 75
  • Last Modified:

How do I force new pages for each chapter in a MS Word "directory" merge?

I have 2000 questions that I am publishing into a book. The questions are from various chapters (1 to 330) and I would like each chapter to appear at the top of the page, such as "Chapter 100" when advancing to the next chapter. Can this be done in MS Word? How about MS Publisher, instead of Word? Or are there third party programs that can be purchased?

I know I can manually go through the final document and add in page breaks and chapter headings, but this will take too much time.

THank you.
0
Lev Seltzer
Asked:
Lev Seltzer
  • 4
  • 3
1 Solution
 
Dr. KlahnPrincipal Software EngineerCommented:
There must be something that separates one chapter from the next.  Suggest:  do a search-and-replace and apply the paragraph page break (Format option, in the version I have) as part of the change.

Adding page breaks using search-and-replace
0
 
Lev SeltzerAuthor Commented:
I have 2000 questions. each question has a chapter number in one of the data fields. When the chapter number is different from the previous chapter number, that is when I want the heading to be displayed.
0
 
GrahamSkanRetiredCommented:
You can use a Wildcard Find and Replace
Find: ^13(Chapter [0-9]{1,}^13)
Replace: ^p^m\1
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
GrahamSkanRetiredCommented:
Sorry. I cross-posted and didn't see your new requirement. Can you post a sample document, please?
0
 
Lev SeltzerAuthor Commented:
The datafile has 200 records. Let's say that the first 15 records have a "1" in the chapter field. Records 16 through 28 have a "2" in the chapter field. Records 29 through 40 have a "3", etc.

I want to start a new page after record 15 with a heading "Chapter 2" on it.
0
 
GrahamSkanRetiredCommented:
There are two main ways.

Firstly you can do it during the merge using fields - perhaps a bit like this:
{ IF { MERGESEQ } = "1" "{ MERGEFIELD CITY }¶
" "" }{ SET Place1 { MERGEFIELD CITY }}¶
{ If { Place2 } <> { Place1 }"¶
{ MERGEFIELD CITY }¶

{ MERGEFIELD EMPLOYEE } { MERGEFIELD SALES }" "{ MERGEFIELD EMPLOYEE } { MERGEFIELD SALES }" }{ SET Place2 { MERGEFIELD CITY }}¶

Open in new window

This field complex is from a Microsoft article here:
https://support.microsoft.com/en-us/kb/294686

Another method would be to run a VBA macro on the output document. To do this it would be necessary to extract the chapter number from the text. There are no mergefields in the merge result document. Therefore it would be necessary to find the data by the context, so it would help to see a sample output document.
0
 
Lev SeltzerAuthor Commented:
Perfect. This took time to write, but it worked EXACTLY as I needed it to. Thank you for finding this for me.
0
 
GrahamSkanRetiredCommented:
Thanks
I congratulate you. I have modified that structure several times in the past to suit slightly different circumstances and each time it took ages.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now