Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Document Revisions/ Track Changes question URGENT (Office 2002)

    Hi,

    I am using the following procedure to indentify content deletions which have been tracked with the 'Track Changes' facility. I am printing out the date of the deletion for debugging purposes.

    Sub DetectDeletions()

    Dim objRevision As Revision
    Dim objRevisions As Revisions

    Set objRevisions = Selection.Range.Revisions

    For Each objRevision In objRevisions
    If objRevision.Type = wdNoRevision Then
    'Do Nothing
    End If
    If objRevision.Type = wdRevisionDelete Then
    Debug.Print objRevision.Date
    objRevision.Accept
    End If
    Next objRevision

    End Sub

    What I need to be able to do, however, is access the actual text of the deletion. Despite being able to access the Date, Author, Parent info, there doesn't appear to be a property to access the actual text. Is this possible?

    Any help would be much appreciated [img]/forums/images/smilies/smile.gif[/img]

    Many thanks,

    Chris

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Document Revisions/ Track Changes question URGENT (Office 2002)

    Try

    objRevision.Range.Text

    to get the (unformatted) text.

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Document Revisions/ Track Changes question URGENT (Office 2002)

    You can get the text from the Range property of the revision, for example...
    <pre>Public Sub ShowRevisions()
    Dim revNext As Revision
    For Each revNext In ActiveDocument.Revisions
    If revNext.Type = wdRevisionDelete Then
    MsgBox revNext.Range.Text & "DELETED"
    ElseIf revNext.Type = wdRevisionInsert Then
    MsgBox revNext.Range.Text & "INSERTED"
    End If
    Next revNext
    End Sub
    </pre>

    StuartR

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Document Revisions/ Track Changes question URGENT (Office 2002)

    Hans,

    You type faster than I...

    StuartR

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Document Revisions/ Track Changes question URGENT (Office 2002)

    Stuart,

    I type less than you ... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    HansV

  6. #6
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Revisions/ Track Changes question URGENT (Office 2002)

    Thanks chaps! Problem solved [img]/forums/images/smilies/smile.gif[/img]

    In case you are interested, here is the code: It searches for and accepts and section break deletions it finds within the document.

    Sub AcceptDeletions()

    Dim objRevision As Revision
    Dim objRevisions As Revisions
    Dim lngSectionBreak As Long

    Set objRevisions = Selection.Range.Revisions

    For Each objRevision In objRevisions
    If objRevision.Type = wdNoRevision Then
    Debug.Print objRevision.Type
    End If
    If objRevision.Type = wdRevisionConflict Then
    Debug.Print objRevision.Type
    End If
    If objRevision.Type = wdRevisionDelete Then
    Debug.Print objRevision.Date
    lngSectionBreak = InStr(objRevision.Range.Text, Chr(12))
    If lngSectionBreak > 0 Then 'Section Break Deletion
    objRevision.Accept 'Accept Section Break Deletion
    End If
    End If
    Next objRevision

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •