How to Update Fields in Shapes or Header or Footer?

J

Jing You

hi,

There are some fields in Shapes of document. The code
ThisDocument.fields.update can not update these fields. I don't know how to
update them using VBA code. The same problem exists with fields in Header or
Footer of document.

Does anyone can help me and give a example?


Thanks,

Jing You
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Jing You > écrivait :
In this message, < Jing You > wrote:

|| hi,
||
|| There are some fields in Shapes of document. The code
|| ThisDocument.fields.update can not update these fields. I don't know how
to
|| update them using VBA code. The same problem exists with fields in Header
or
|| Footer of document.
||
|| Does anyone can help me and give a example?
||
||
See
http://word.mvps.org/faqs/customization/ReplaceAnywhere.htm
to get a code example on how to cycle through all of a document stories
(headers, footers, textboxes, endnotes, footnotes, body text, etc.)

This is for replacing text but you can adapt it for updating by using each
story range,
e.g.:

'_______________________________________
Do Until (rngStory Is Nothing)
rngStory.Fields.Update
Set rngStory = rngStory.NextStoryRange
Loop
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top