Perhaps something like:
Sub ScratchMacro()
Dim oDoc As Document
Dim oRng As Word.Range
Dim oSec As Long
Dim i As Long
Set oDoc = ActiveDocument
For oSec = 1 To oDoc.Sections.Count
With oDoc.Sections(oSec)
For i = 1 To 3
With .Headers(i)
.LinkToPrevious = False
.Range.InsertAfter
oDoc.AttachedTemplate.AutoTextEntries("ATTN:")
End With
With .Footers(i)
.LinkToPrevious = False
.Range.InsertAfter
oDoc.AttachedTemplate.AutoTextEntries("ATTN:")
End With
Next i
End With
Next oSec
End Sub
> Is there a way to add an autotext entry to ALL headers and footers in a
> document no matter if there is a different first page or not, or if
> there are multiple sections or not?
fumei - 29 Nov 2007 21:49 GMT
Or...
Sub AllHeaders()
Dim oHF As HeaderFooter
Dim oSection As Section
For Each oSection In ActiveDocument.Sections
For Each oHF in oSection.Headers
NormalTemplate.AutoTextEntries("Attn:").Insert _
Where:=oHF.Range, RichText:=True
Next
For Each oHF in oSection.Footers
NormalTemplate.AutoTextEntries("Attn:").Insert _
Where:=oHF.Range, RichText:=True
Next
Next
End Sub
No loops, or counters. Adjusted for NormalTemplate vs. AttachedTemplate as
required of course.
>Perhaps something like:
>
[quoted text clipped - 25 lines]
>> document no matter if there is a different first page or not, or if
>> there are multiple sections or not?