History: I have a macro (not shown) that deletes the blank page that comes between the cover page and the proprietary page of a Word document that is generated from RoboHelp. However, the cover and the proprietary pages become the same section and the footer section (macro driven as well) is added to the cover. After, another round of coding and testing to address the footer appearing on the cover page (recall, after deleting the blank page), we found a way to delete the footer info, but it would have to be done for both the Cover page and the Proprietary page (have no issues with that). However, I have an issue that I need assitance on from one of the VBA gurus out there.
Problem: I need to remove the chapter name in the top-right hand corner (image link below).
Prior to the Word 2013 macros running, the chapter titles are listed in the header on every other page (even page has the name of the chapter in the document, e.g. Navigation). When running the macros, it removes the chapter names in the header, and does all the other custom formatting.
What I believe is happening: It is because we’re not processing the headers and footers in the first two sections (see red below in code excerpt). I think I might need to make an adjustment so that only the footer logic is skipped if the section index is less than or equal to 2. That way the headers should still be processed as necessary. So, how do I go about this?
I am guessing I will need to add some logic (within the existing code I have) that will look for ANY Text = “ ” only in Even Page Header - Section 1 and remove it ???
Thank you,
~PM
CODE:
Sub headerFooter()
Dim s As Section
For Each s In ActiveDocument.Sections
' Skip first two sections
If s.Index <= 2 Then GoTo NextSection
DoHeader s.Headers(wdHeaderFooterFirstPage)
DoFirstFooter s.Footers(wdHeaderFooterFirstPage)
DoHeader s.Headers(wdHeaderFooterPrimary)
DoOddFooter s.Footers(wdHeaderFooterPrimary)
DoHeader s.Headers(wdHeaderFooterEvenPages)
DoEvenFooter s.Footers(wdHeaderFooterEvenPages)
NextSection:
Next s
End Sub