Hi Guys,
I'm copying multiple word documents from one folder, make a few changes and save them in a different folder. (WORD 2007)
I'm having problems when it comes to inserting a header to ALL header sections. The code below only applies the header to last page. I would ideally want this code to open all header sections and insert a customised
header stored in my building blocks.dotx.
This is my current code:
Dim oHF As HeaderFooter
Dim oSection As Section
For Each oSection In ActiveDocument.Sections
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
For Each oHF In oSection.Headers
Templates.LoadBuildingBlocks
For Each Template In Templates
If Template.Name = "Building Blocks.dotx" Then
Templates(Template.FullName). _
BuildingBlockEntries("my.logo"). _
Insert Where:=Selection.Range, RichText:=True
End If
Next
Next
Next
Many thanks in advance,
I'm copying multiple word documents from one folder, make a few changes and save them in a different folder. (WORD 2007)
I'm having problems when it comes to inserting a header to ALL header sections. The code below only applies the header to last page. I would ideally want this code to open all header sections and insert a customised
header stored in my building blocks.dotx.
This is my current code:
Dim oHF As HeaderFooter
Dim oSection As Section
For Each oSection In ActiveDocument.Sections
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
For Each oHF In oSection.Headers
Templates.LoadBuildingBlocks
For Each Template In Templates
If Template.Name = "Building Blocks.dotx" Then
Templates(Template.FullName). _
BuildingBlockEntries("my.logo"). _
Insert Where:=Selection.Range, RichText:=True
End If
Next
Next
Next
Many thanks in advance,
Last edited: