Email this Page Log Support Call Send Feedback Print

Previous Topic

Next Topic

Book Contents

Book Index

Adding Chapter or Section Numbering to Page Numbers in Word

There are times when you may have a requirement to use page numbering that also contains the chapter number - for example, 1-7, 3-21, etc.

This can be achieved quite easily, with a few small changes to your Word Publishing template and an AfterPublish macro.

To Add Chapter Numbering to Page Numbers:

  1. Open your Word Publishing template.

    This is defined under the Document tab of the Book Object, and in most cases is inherited from the template your Book is based on.

    Word Publishing Template

  2. Modify the Heading 1 style in Word to ensure it uses Outline Numbering.

    Note: This can be hidden if you don't want the actual headings to appear numbered, by adjusting the Font settings.

    Customize Outline Numbering

  3. Add the following AfterPublish macro to your template:
Sub AfterPublish() 

Dim DocSection As Section 

    For Each DocSection In ActiveDocument.Sections 
        With DocSection.Headers(1).PageNumbers 
            .NumberStyle = wdPageNumberStyleArabic 
            .IncludeChapterNumber = True 
            .HeadingLevelForChapter = 0 
            .ChapterPageSeparator = wdSeparatorHyphen 
            .RestartNumberingAtSection = True 
            .StartingNumber = 1 
        End With 
    Next DocSection 
    ActiveDocument.Fields.Update 
End Sub 

Note: To restart the numbering for each chapter, (for example, 1-1, 2-1, 3-1 etc) ensure .RestartNumberingAtSection is set to True.
To continue the numbering, ensure it is set as False.

Top of Page Email this Page Log Support Call Send Feedback Print