Update Revision number in different sections of document?

D

dlowrey

Hi
I have a revision number field in the header in two sections that are not
linked. I want to update the revision numbers when I close the document.
The below code only updates the revision number in the first section.

Any ideas? Thanks in advance for taking the time to look.


SubAutoClose()
Dim oField As Field
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
For Each oField In oStory.Fields

If oField.Type = wdFieldRevisionNum Then
oField.Update
End If

Next oField
Next oStory
EndSub
 
D

Doug Robbins - Word MVP on news.microsoft.com

Dim i As Long, j As Long
With ActiveDocument
For i = 1 To .Sections.Count
With .Sections(i).Headers(wdHeaderFooterPrimary).Range
For j = 1 To .Fields.Count
If .Fields(j).Type = wdFieldRevisionNum Then
.Fields(j).Update
End If
Next j
End With
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
Top