Sub ModifyHeaderFields()
Dim sec As Word.Section
Dim fld As Word.Field
Dim s As Integer
Dim secStart As Integer
Dim langs() As String
Dim h As Word.WdHeaderFooterIndex
langs = Split("EN,ES,FR,IT", ",")
secStart = Selection.Sections(1).Index
For s = 0 To 3
Set sec = ActiveDocument.Sections(secStart + s)
For h = wdHeaderFooterPrimary To wdHeaderFooterEvenPages Step 2 'omit first page header
For Each fld In sec.Headers(h).Range.Fields
If fld.Type = wdFieldRef Then
fld.Code.Text = Replace(fld.Code.Text, "bookmark_DE", "bookmark_" & langs(s))
fld.Update
End If
Next fld
Next h
Next s
End Sub
|