K
kalyan
Hi All
In my template am having merge fields in the header and footer
sections of the document...along with the PAGE field...so excluding
these PAGE field i need to unlink all the other merge fields...can any
body suggest a macro code to perform this action...
Earlier help is highly appreciated!!!!!!!
my code is as follows
Dim oHeader As HeaderFooter
Dim oFooter As HeaderFooter
Dim oSection As Section
Dim a
For Each oSection In ActiveDocument.Sections
For Each oFooter In oSection.Footers
For a = 1 To oFooter.Range.Fields.Count
If oFooter.Range.Fields(a).Code.Text <> "PAGE" Then
oFooter.Range.Fields(a).Unlink
oFooter.Range.Fields(a).Select
Selection.ClearFormatting(using this to unhilight/
deshade the result)
End If
Next
Next
Next
Set oFooter = Nothing
Set oHeader = Nothing
Set oSection = Nothing
but am getting the error collection doesn't exist
Thanks & Regards
Kalyan
In my template am having merge fields in the header and footer
sections of the document...along with the PAGE field...so excluding
these PAGE field i need to unlink all the other merge fields...can any
body suggest a macro code to perform this action...
Earlier help is highly appreciated!!!!!!!
my code is as follows
Dim oHeader As HeaderFooter
Dim oFooter As HeaderFooter
Dim oSection As Section
Dim a
For Each oSection In ActiveDocument.Sections
For Each oFooter In oSection.Footers
For a = 1 To oFooter.Range.Fields.Count
If oFooter.Range.Fields(a).Code.Text <> "PAGE" Then
oFooter.Range.Fields(a).Unlink
oFooter.Range.Fields(a).Select
Selection.ClearFormatting(using this to unhilight/
deshade the result)
End If
Next
Next
Next
Set oFooter = Nothing
Set oHeader = Nothing
Set oSection = Nothing
but am getting the error collection doesn't exist
Thanks & Regards
Kalyan