I have a macro that cuts a document into sections of one page each:
Selection.HomeKey Unit:=wdStory
While Selection.Information(wdActiveEndPageNumber) < Selection.Information(wdNumberOfPagesInDocument)
ActiveDocument.Bookmarks("\page").Range.Select
With Selection.Find
.Text = "^b"
.Forward = True ' or False
.Wrap = wdFindStop
.Format = False
If .Execute Then
' found section break: go to next page
Selection.GoToNext wdGoToPage
Else
' found no section break: append one
Selection.Collapse Direction:=wdCollapseEnd
Selection.InsertBreak Type:=wdSectionBreakNextPage
End If
End With
Wend
I can re-run the macro after editing the document and only an extended page will be split again.
Following the above code I loop over all sections and disable the 'link to previous' property in the headers and footers. Then I loop over the sections again to 'unlink' the PAGE and NUMPAGE fields, that is, to replace the fields with their actual values.
This works for some documents and doesn't for others. In a problem document, when I enter a section break (manually or via VBA), the page number on the following section jumps to 1, while in a no-problem document it does not.
How do I control automatic page number updating when adding a section break?