A
Alex
Hi Everyone
Posted this earlier this week on the Word programming
newsgroup but no replies, so trying here.
I've been using the following code to update the fields
in
my headers and footer.
Sub UpdateHF()
Dim oField As Field
Dim oSection As Section
Dim oHeader As HeaderFooter
Dim oFooter As HeaderFooter
For Each oSection In ActiveDocument.Sections
For Each oHeader In oSection.Headers
If oHeader.Exists Then
For Each oField In oHeader.Range.Fields
oField.Update
Next oField
End If
Next oHeader
For Each oFooter In oSection.Footers
If oFooter.Exists Then
For Each oField In oFooter.Range.Fields
oField.Update
Next oField
End If
Next oFooter
Next oSection
End Sub
However, I recently created a template that has a
floating textbox anchored to the footer, and within the
textbox is a custom doc property field. This doc
property field displays a manually entered version and is
in the textbox so I can display it as a Vertical
watermark on every page of the document. I know I can
specify watermark text in Word 2000, XP and 2003, but I
have the added problem of making it work on word 97,
hence the textbox method.
What I am finding is when the above code runs it updates
all the fields with the headers and footers except the
field within the textbox.
I changed the textbox to a frame and the code worked, but
unfortunately, frames have limited wrapping options and I
cannot place the frame behind text.
So my question is, can the above code be changed to
update the field within the textbox as well as all the
other fields within the headers and footers, and if so
how.
Regards
Alex
Posted this earlier this week on the Word programming
newsgroup but no replies, so trying here.
I've been using the following code to update the fields
in
my headers and footer.
Sub UpdateHF()
Dim oField As Field
Dim oSection As Section
Dim oHeader As HeaderFooter
Dim oFooter As HeaderFooter
For Each oSection In ActiveDocument.Sections
For Each oHeader In oSection.Headers
If oHeader.Exists Then
For Each oField In oHeader.Range.Fields
oField.Update
Next oField
End If
Next oHeader
For Each oFooter In oSection.Footers
If oFooter.Exists Then
For Each oField In oFooter.Range.Fields
oField.Update
Next oField
End If
Next oFooter
Next oSection
End Sub
However, I recently created a template that has a
floating textbox anchored to the footer, and within the
textbox is a custom doc property field. This doc
property field displays a manually entered version and is
in the textbox so I can display it as a Vertical
watermark on every page of the document. I know I can
specify watermark text in Word 2000, XP and 2003, but I
have the added problem of making it work on word 97,
hence the textbox method.
What I am finding is when the above code runs it updates
all the fields with the headers and footers except the
field within the textbox.
I changed the textbox to a frame and the code worked, but
unfortunately, frames have limited wrapping options and I
cannot place the frame behind text.
So my question is, can the above code be changed to
update the field within the textbox as well as all the
other fields within the headers and footers, and if so
how.
Regards
Alex