I am trying to link to previous/overwrite headers/footers in all sections with the header/footer from section 3 under VBA. The documents have been setup a "Back Cover Section" which includes Appendices and the actual back cover (separate section from Appendices section). For some reason, I can't replace the headers/footer of the Appendices section using VBA - I can do it by manual section and making it 'Same as Previous'. Also, sections following the Appendices section are changeable and be able to set to previous.
Firstly, how is a 'Back Cover Section' setup? Is there any way to get rid of it and make it just a standard section?
Secondly, is there anyway I can overwrite its headers/footers? Simply put, all sections in the document have the *same* header/footer content so making each next section as 'link to previous' should fix it but doesn't.
Code: Select all
Sub testResetHeadersFootersOfIONDocs()
Call ResetHeadersFootersOfTheDoc(ActiveDocument)
End Sub
Function ResetHeadersFootersOfTheDoc(iDoc As Document)
'
' ResetHeadersFootersOfTheDoc
'
'
Dim Rng As Range
Dim i As Long
For i = 2 To iDoc.Sections.Count
With iDoc.Sections(i)
.Headers(wdHeaderFooterFirstPage).LinkToPrevious = True
.Headers(wdHeaderFooterPrimary).LinkToPrevious = True
.Headers(wdHeaderFooterEvenPages).LinkToPrevious = True
.Footers(wdHeaderFooterFirstPage).LinkToPrevious = True
.Footers(wdHeaderFooterPrimary).LinkToPrevious = True
.Footers(wdHeaderFooterEvenPages).LinkToPrevious = True
End With
Next i
End Function