Is there a way to use track changes to create a table of changes?

  • Thread starter Doug Robbins - Word MVP
  • Start date
D

Doug Robbins - Word MVP

Something like this might give you what you want:

Dim arev As Revision
Dim source As Document
Dim target As Document
Set source = ActiveDocument
Set target = Documents.Add
Dim revtype As String
With source
For Each arev In .Revisions
Select Case arev.Type
Case 1
revtype = "Inserted"
Case 2
revtype = "Deleted"
Case Else
revtype = "Format Changed"
End Select
With target.Range
.InsertAfter "Page " &
arev.Range.Information(wdActiveEndPageNumber) & vbTab & _
revtype & vbTab & arev.Range & vbTab & "by " & arev.Author &
vbCr
End With
Next arev
End With
target.Range.ConvertToTable vbTab

There are a whole range of revision .Types:

wdNoRevision
wdRevisionDelete
wdRevisionInsert
wdRevisionParagraphProperty
wdRevisionReconcile
wdRevisionSectionProperty
wdRevisionStyleDefinition
wdRevisionConflict
wdRevisionDisplayField
wdRevisionParagraphNumber
wdRevisionProperty
wdRevisionReplace
wdRevisionStyle
wdRevisionTableProperty

but the delete and insert are probably the ones that you are interested in
and in the above macro, any others will be described as "Format Changed"
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

mistletoe313

Thanks much!
Have a magical day!

Doug Robbins - Word MVP said:
Something like this might give you what you want:

Dim arev As Revision
Dim source As Document
Dim target As Document
Set source = ActiveDocument
Set target = Documents.Add
Dim revtype As String
With source
For Each arev In .Revisions
Select Case arev.Type
Case 1
revtype = "Inserted"
Case 2
revtype = "Deleted"
Case Else
revtype = "Format Changed"
End Select
With target.Range
.InsertAfter "Page " &
arev.Range.Information(wdActiveEndPageNumber) & vbTab & _
revtype & vbTab & arev.Range & vbTab & "by " & arev.Author &
vbCr
End With
Next arev
End With
target.Range.ConvertToTable vbTab

There are a whole range of revision .Types:

wdNoRevision
wdRevisionDelete
wdRevisionInsert
wdRevisionParagraphProperty
wdRevisionReconcile
wdRevisionSectionProperty
wdRevisionStyleDefinition
wdRevisionConflict
wdRevisionDisplayField
wdRevisionParagraphNumber
wdRevisionProperty
wdRevisionReplace
wdRevisionStyle
wdRevisionTableProperty

but the delete and insert are probably the ones that you are interested in
and in the above macro, any others will be described as "Format Changed"
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

mistletoe313

Do I use this by saving it as a macro? (Sorry, I wasn't expecting a VBA
answer...)
 
M

mistletoe313

sorry - I've never been in a newsgroup or chatroom, etc, before
But thanks : )
 

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