Nic, you might just want to add some code at the end of your document that
updates all the fields for you:
Sub
UpdateAllDocFields()
Dimsry
ForEach sry
In ActiveDocument.StoryRanges
sry.Fields.Update
NextStr
End
Sub
*******************
~Anne Troy
www.OfficeArticles.com
www.MyExpertsOnline.com
> Am self taught in VBA so please be patient with me!!
>
[quoted text clipped - 74 lines]
>
> Nic
Nic - 07 Jul 2005 01:15 GMT
Anne,
Apologies for my not understanding. I only have very basic knowledge of
programming. Your assistance is much appreciated.
I created a new module in the template and pasted your text in from below.
The following error message was displayed:
Compile Error: Expected: line number or label or statement or end of
statement.
What am I doing wrong??
Thanks again for your assistance.
Nic
> Nic, you might just want to add some code at the end of your document that
> updates all the fields for you:
[quoted text clipped - 100 lines]
> >
> > Nic
Anne Troy - 07 Jul 2005 01:30 GMT
Hm. I copied it from MSDN, and never even looked. It looks to me like
NextStr should be NextSry
*******************
~Anne Troy
www.OfficeArticles.com
www.MyExpertsOnline.com
> Anne,
>
[quoted text clipped - 115 lines]
> > >
> > > Nic
Jean-Guy Marcil - 07 Jul 2005 02:08 GMT
Anne Troy was telling us:
Anne Troy nous racontait que :
> Nic, you might just want to add some code at the end of your document
> that updates all the fields for you:
[quoted text clipped - 12 lines]
> End
> Sub
It should be:
'_______________________________________
Sub UpdateAllDocFields()
Dim sry As StoryRange
For Each sry In ActiveDocument.StoryRanges
sry.Fields.Update
Next
End Sub
'_______________________________________
But even that will not work all the time. It will not work if you have
fields in more than one textbox, or if you have unlinked odd/even
headers/footers.
For a complete cure to those problems, see:
http://www.word.mvps.org/faqs/customization/ReplaceAnywhere.htm
and replace the code about replacing by the code for updating (from above).
(i.e. replace
SearchAndReplaceInStory rngStory, "cat", "dog"
by
rngStory.Fields.Update
and don't use the SearchAndReplaceInStory Sub.)

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org