Automatically update field

R

rhg

Hello,

I have a document with several custom properties that we've added such as
'Client'.

Using VBA we prompt for the value of the custom property and update it using

ActiveDocument.CustomDocumentProperties("Client").Value = "Name"

This all works great and the new value for the custom property is saved.

However, the field in the document header linked to this custom property
does not get updated.

Is there any way to automatically update the field linked to this custom
property?

Right now the user has to edit the document and use "Update field" to update
the field with the new value for the custom property.

Thanks,

Russ
 
G

Greg

Add in something like the following to your code:

Dim pRange As Word.Range
For Each pRange In ActiveDocument.StoryRanges
Do
pRange.Fields.Update
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
 

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