Extracting Revisions by paragraph and sentence

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 except all revisions are printed out for each paragraph
and sentence within each paragraph. In other words, all revisions are
printed out for Para 1 and sentence 1, para 1 and sentence 2,...para8 and
sentence 1, and so forth. T

The 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 apprecitated.
 

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