Ranges in Word

R

Rick

Hi

I am using fields to populate a word document but have found that header and
footer fields are not populated. Is it possible to get the range object to
include everything including the header and footer?

I believe wdStory is the whole document but could I use a simple wdStory +
header + footer type of command to increase the range?

Thanks
 
G

Greg Maxey

Rick,

wdStory is the story with the IP an in most cases wdMainText there are
about 12-16 other stories depending on the word version.

Sub myUpdateFields()
Dim pRange As Word.Range
Dim iLink As Long
iLink = ActiveDocument.Sections(1).Headers(1).Range.StoryTypes
For Each pRange In ActiveDocument.StoryRanges
Do
pRange.Fields.Update
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
End Sub

Also see 2.g at this link:

http://gregmaxey.mvps.org/Repeating_Data.htm
 

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