J
John Wirt
The following procedure is suppose to extract the revisions in a document by
paragraph and sentence within each pragraph:
**************************
Public Sub ExtractRevisions()
Dim Revn As Revision
Dim colRevns As Revisions
Dim rngRevns As Range
Dim Para As Paragraph
Dim colParas As Paragraphs
Dim rngPara As Range
Dim colSents As Sentences
Dim rngSent As Range
cntParas = ActiveDocument.Paragraphs.Count
For I = 1 To cntParas
Set colSents = ActiveDocument.Paragraphs(I).Range.Sentences
For J = 1 To colSents.Count
Set colRevns = colSents(J).Revisions
If colRevns Is Nothing Then GoTo NextJ
For Each Revn In colRevns
Debug.Print "Para" & Str(I) & " Sent" & Str(J) & " Rev:" &
Revn.Range.Text
Next Revn
NextJ:
Next J
Next I
End Sub
****************************
The program compiles but all revisions are printed out for each paragraph
and sentence within each paragraph. In other words, all revisions in the
whole document are printed out for Para 1 and sentence 1, para 1 and
sentence 2,...para8 and
sentence 1, and so forth. The same revisions for all paragraphs and
sentences.
The paragraphs and sentences print out correctly (there are only as many
sentences within
each paragraph as there are sentences within each paragraph. It's just that
all revisions are attached to each paragraph and sentence, when in a test
run there were only two revisions in one of the sentences in one of the
paragraphs. The number of paragraphs and sentences that print out is
correcct.
ANy help will be greatly appreciated.
John Wirt
paragraph and sentence within each pragraph:
**************************
Public Sub ExtractRevisions()
Dim Revn As Revision
Dim colRevns As Revisions
Dim rngRevns As Range
Dim Para As Paragraph
Dim colParas As Paragraphs
Dim rngPara As Range
Dim colSents As Sentences
Dim rngSent As Range
cntParas = ActiveDocument.Paragraphs.Count
For I = 1 To cntParas
Set colSents = ActiveDocument.Paragraphs(I).Range.Sentences
For J = 1 To colSents.Count
Set colRevns = colSents(J).Revisions
If colRevns Is Nothing Then GoTo NextJ
For Each Revn In colRevns
Debug.Print "Para" & Str(I) & " Sent" & Str(J) & " Rev:" &
Revn.Range.Text
Next Revn
NextJ:
Next J
Next I
End Sub
****************************
The program compiles but all revisions are printed out for each paragraph
and sentence within each paragraph. In other words, all revisions in the
whole document are printed out for Para 1 and sentence 1, para 1 and
sentence 2,...para8 and
sentence 1, and so forth. The same revisions for all paragraphs and
sentences.
The paragraphs and sentences print out correctly (there are only as many
sentences within
each paragraph as there are sentences within each paragraph. It's just that
all revisions are attached to each paragraph and sentence, when in a test
run there were only two revisions in one of the sentences in one of the
paragraphs. The number of paragraphs and sentences that print out is
correcct.
ANy help will be greatly appreciated.
John Wirt