Reg Working with Revisions using vb (code attached) 
Author Message
 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



Mon, 12 Jul 2004 19:31:40 GMT  
 Reg Working with Revisions using vb (code attached)
Dear Ragu,

you *may* get some joy from copying the range to a new document and
accepting all changes, or even making a copy of the document,
bookmarking the range, accepting all changes and {*filter*} the
bookmarks contents.



Quote:
>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

Steve Hudson, Word Heretic
HDK List MVP

Please reply via the newsgroups so that everyone can share


Mon, 19 Jul 2004 20:47:44 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Reg: Using Vb code how to perform some functions in Epson LQ-300 printer

2. Reg Type Revision

3. Attach a generated revision number to my email

4. Attach to a running process? (Using code)

5. Revisions collection stops code in a table

6. Attaching VB code to Detail section in Access 95 report

7. Converting Word Revision Marks to PDF Annotations Using PDF Marks

8. Help: attaching Btrieve-table in Access mdb using VB 4.0 16-bit

9. How to attach tables to a readonly Access 2.0 database using VB

10. Using Setup Wizard for updates/revisions - a problem

11. Using Setup Wizard for updates/revisions

12. Help: attaching Btrieve table in Access 2.0 database using VB 4.0 16-bit

 

 
Powered by phpBB® Forum Software