View Single Post
 
Old 07-25-2023, 05:00 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

In your document template, create a building block entry of the Primary Page Header content (minus the final paragraph mark). Name it "HPP"


Create a building block entry of the Even Page Header content (minus the final paragraph mark). Name it "HEP"


Run this macro:

Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oHF As HeaderFooter
Dim oRng As Range
  For Each oHF In ActiveDocument.Sections(1).Headers
    Set oRng = oHF.Range
    Select Case oHF.Index
      Case wdHeaderFooterPrimary
        oRng.Text = vbNullString
        oRng.Collapse wdCollapseStart
        ActiveDocument.AttachedTemplate.BuildingBlockEntries("HPP").Insert oRng
      Case wdHeaderFooterEvenPages
        oRng.Text = vbNullString
        oRng.Collapse wdCollapseStart
        ActiveDocument.AttachedTemplate.BuildingBlockEntries("HEP").Insert oRng
     End Select
  Next
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote