Hi,
I am trying to insert word documents, and then add a section to restart page numbering for each newly inserted document. However, the page numbers do not restart, and the first document has no page numbers at all:
m_WordApp.ActiveDocument.Repaginate()'If Not fileArray.Contains(filepath) Then
Dim oSection = m_WordApp.ActiveDocument.Sections.Add()
oSection.PageSetup.DifferentFirstPageHeaderFooter = False
oSection.Footers(WdHeaderFooterIndex.wdHeaderFooterPrimary).LinkToPrevious = False
oSection.Footers(WdHeaderFooterIndex.wdHeaderFooterPrimary).PageNumbers.Add(WdPageNumberAlignment.wdAlignPageNumberCenter)
m_WordApp.Selection.InsertFile(filepath, ConfirmConversions:=False, Range:="", Link:=False, Attachment:=False)
'm_WordApp.Selection.InsertParagraphAfter()
m_WordApp.ActiveDocument.Repaginate()
m_WordApp.Selection.InsertBreak(Type:=WdBreakType.wdPageBreak)
m_WordApp.Selection.EndKey(Unit:=6)
m_WordApp.Selection.Collapse(Direction:=WdCollapseDirection.wdCollapseEnd)
The initial formatting is as follows:
Dim oSection = paragraph1.Range.Sections.Add()oSection.Footers(1).LinkToPrevious = False
' objDoc.Sections(1).Footers(1).PageNumbers.Add(wdAlignPageNumberCenter)
oSection.Footers(WdHeaderFooterIndex.wdHeaderFooterPrimary).PageNumbers.Add(WdPageNumberAlignment.wdAlignPageNumberCenter)
Any help would be greatly appreciated