The problems arise as there are three possible headers for each section, and
each header would need to be addressed separately with due regard for
whatever may already be in the header to which you wish to add a watermark.
If I was doing this for myself, I would save the watermark as an autotext
entry (building block in Word 2007) in the normal template (or the document
template) . This eliminates all that formatting on the fly. Then insert the
autotext (building block) entry at the end of each of the header ranges, for
each section, as follows.
If you save the autotext entry in the document template then Instead of
NormalTemplate use ActiveDocument.AttachedTemplate
Sub UncontrolledWord2007()
Dim i As Long
Dim oRange As Range
Dim oBB As BuildingBlock
Set oBB = NormalTemplate.BuildingBlockEntries("UNCONTROLLED")
For i = 1 To ActiveDocument.Sections.Count
Set oRange =
ActiveDocument.Sections(i).Headers(wdHeaderFooterFirstPage).Range
oRange.Collapse wdCollapseEnd
oBB.Insert _
Where:=oRange, _
RichText:=True
Set oRange =
ActiveDocument.Sections(i).Headers(wdHeaderFooterPrimary).Range
oRange.Collapse wdCollapseEnd
oBB.Insert _
Where:=oRange, _
RichText:=True
Set oRange =
ActiveDocument.Sections(i).Headers(wdHeaderFooterEvenPages).Range
oRange.Collapse wdCollapseEnd
oBB.Insert _
Where:=oRange, _
RichText:=True
Next i
End Sub
Sub UncontrolledWord2003()
Dim i As Long
Dim oRange As Range
For i = 1 To ActiveDocument.Sections.Count
Set oRange =
ActiveDocument.Sections(i).Headers(wdHeaderFooterFirstPage).Range
oRange.Collapse wdCollapseEnd
NormalTemplate.AutoTextEntries("UNCONTROLLED") _
.Insert Where:=oRange, _
RichText:=True
Set oRange =
ActiveDocument.Sections(i).Headers(wdHeaderFooterPrimary).Range
oRange.Collapse wdCollapseEnd
NormalTemplate.AutoTextEntries("UNCONTROLLED") _
.Insert Where:=oRange, _
RichText:=True
Set oRange =
ActiveDocument.Sections(i).Headers(wdHeaderFooterEvenPages).Range
oRange.Collapse wdCollapseEnd
NormalTemplate.AutoTextEntries("UNCONTROLLED") _
.Insert Where:=oRange, _
RichText:=True
Next i
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>