Help required in the Macro for extracting the track changes and comments

K

karthunairh

Hi,

I am writing a macro in Excel to extract the track changes and comment
in a word document.

I was able to extract all the details except the page number in whic
the change has been incorporated.

Can anyone Please help me with a solution for the same.

This is the source code which i have used to extract the details.


'/***************************************************
Dim revTemp As Revision
Dim a() As String
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim docsize As String

Sub ToExcel()

RFN = Application.InputBox("Enter the file name with the entir
file path")

On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then 'Word isn't already running
Set wdApp = CreateObject("Word.Application")
End If

Set wdDoc = wdApp.Documents.Open(RFN)
wdDoc.Activate

'Get all track changes
total = wdDoc.Revisions.Count
If total <= 0 Then
Exit Sub
End If
For i = 1 To total
Set revTemp = wdDoc.Revisions(i)
If revTemp Is Nothing Then
Else
If revTemp.FormatDescription = "" Then
ReDim Preserve a(i)
If revTemp.Type = wdRevisionInsert Then
type1 = "Inserted"
ElseIf revTemp.Type = wdRevisionDelete Then
type1 = "Deleted"
End If

a(i) = "Track Changes" & "-" & type1 & " by "
revTemp.Author & "," & " - " & wdDoc.Revisions(i).Range

End If
End If
Next
i = i - 1
'Get all comments
total = wdDoc.Comments.Count
For j = 1 To total
i = i + 1
ReDim Preserve a(i)
With ActiveDocument.Comments(j)
a(i) = "Comment No." & .Index & " by " & .Author & "
" & .Range
End With
Next

counting = i + 1
wdDoc.Close (RFN)

Windows(workname).Activate
End Sub

'/***************************************************

Thanks & Regards,
Karthik
 
N

Norman Jones

Hi Karthunairh,
I was able to extract all the details except the page number in which
the change has been incorporated

This would appear to be a Word issue and I think that your question would
more properly be posed in one of the corresponding Word ng's.


---
Regards,
Norman



"karthunairh" <[email protected]>
wrote in message
 

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