S
Sammy
Hi,
The following macro works in the body of the document but not in the Header
or Footer. What am I doing wrong?? Thanks for your help
Dim strCodes As String
Dim iFld As Integer
Dim strFind As String
Dim strRepl As String
Dim pRange As Word.Range
For Each pRange In ActiveDocument.StoryRanges
Do Until pRange Is Nothing
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If .Type = wdFieldDate Then
.Code.Text = Replace(UCase(.Code.Text), _
"DATE", "CREATEDATE")
End If
End With
Next iFld
Set pRange = pRange.NextStoryRange
Loop
Next
The following macro works in the body of the document but not in the Header
or Footer. What am I doing wrong?? Thanks for your help
Dim strCodes As String
Dim iFld As Integer
Dim strFind As String
Dim strRepl As String
Dim pRange As Word.Range
For Each pRange In ActiveDocument.StoryRanges
Do Until pRange Is Nothing
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If .Type = wdFieldDate Then
.Code.Text = Replace(UCase(.Code.Text), _
"DATE", "CREATEDATE")
End If
End With
Next iFld
Set pRange = pRange.NextStoryRange
Loop
Next