C
Chad DeMeyer
I have seen numerous posts on the functional method for updating all fields
in a document:
Dim oRange As Range
For Each oRange In ActiveDocument.StoryRanges
Do
oRange.Fields.Update
Set oRange = oRange.NextStoryRange
Loop Until oRange Is Nothing
Next
What I haven't seen is an explanation of why this method is necessary. Is
there something wrong with the StoryRanges collection? Normally, a For Each
construct would suffice to loop through the members of a collection, so why
with StoryRanges is it necessary to also loop through the collection using
the NextStoryRange method until its return is Nothing? Furthermore, it
seems like the code above should update the fields in each StoryRange
multiple times, the number of times being equal to the number of StoryRanges
in the document.
Hoping somebody can fill in the blanks.
Regards,
Chad
in a document:
Dim oRange As Range
For Each oRange In ActiveDocument.StoryRanges
Do
oRange.Fields.Update
Set oRange = oRange.NextStoryRange
Loop Until oRange Is Nothing
Next
What I haven't seen is an explanation of why this method is necessary. Is
there something wrong with the StoryRanges collection? Normally, a For Each
construct would suffice to loop through the members of a collection, so why
with StoryRanges is it necessary to also loop through the collection using
the NextStoryRange method until its return is Nothing? Furthermore, it
seems like the code above should update the fields in each StoryRange
multiple times, the number of times being equal to the number of StoryRanges
in the document.
Hoping somebody can fill in the blanks.
Regards,
Chad