
Reg Working with Revisions using vb (code attached)
I am building a program using to trap the revisions made
in a word document.To explain in a much better way a
particular document is worked by X .The same document is
being worked by Y.I have to find the mistakes done by Y
corrected by X.So,I compare both the versions and the
errors get highlighted.The correct ones will be in Red and
underlined and incorrect one in blue and striked out.
Now from the compared version I need to pick the sentences
which has the mistakes.To do this I am using Type
Revisions .I am facing a problem at this stage.
I am able to pick sentences but while picking the Insert
Revisions text the delete revision text also comes.
To explain to you I am attaching the sample word document
as well the code .
Could some one help me
Thanxs
ragu
Sam visitedis visiting the hotel today to havefor a
meeting with all the staff members to briefdiscuss about
their revised pay structure
Note : The VB program will open this document and look out
for revisions.While picking the revisions be it Insert
Revision or Delete revision it will pick up as :
VER1:Sam visitedis visiting the hotel today to havefor a
meeting with all the staff members to briefdiscuss about
their revised pay structure
VER2: Sam visitedis visiting the hotel today to havefor a
meeting with all the staff members to briefdiscuss about
their revised pay structure
But it must come as follows :
VER1: Sam visited the hotel today to have a meeting with
all the staff members to brief about their revised pay
structure
VER2: Sam is visiting the hotel today for a meeting with
all the staff members to discuss about their revised pay
structure.
I hope this will help you
Code used:
logfil.Documents.Open (filenm)
Dim z, z1 As Integer
ActiveDocument.TrackRevisions = True
z1 = ActiveDocument.Revisions.Count
Dim a As Long, b As Long
Dim R As Word.Range
Dim part1 As String, part2 As String
z = 1
Set wdDoc = ActiveDocument
Set wdRevs = wdDoc.Revisions
For Each wdRev In wdRevs
Select Case wdRev.Type
Case wdRevisionInsert
rs2.AddNew
rs2!fnm = rs3!file_nm
rs2!doc2 = wdrev.Range.Sentences
(1).Text
rs2!typ1 = "D:"
rs2.Update
Case wdRevisionDelete
rs2.AddNew
rs2!fnm = rs3!file_nm
rs2!doc1 = wdrev.Range.Sentences
(1).Text
rs2!typ = "T:"
rs2.Update
Case Else
End Select
z = z + 1
Next