View Single Post
 
Old 09-12-2018, 01:06 PM
alzasp alzasp is offline Windows 10 Office 2016
Novice
 
Join Date: Sep 2018
Posts: 2
alzasp is on a distinguished road
Default Exporting Tracked Changes and Comments to Excel

Is there a macro I can use that exports the tracked changes, inserts and deletes, to excel? I have a macro (below) that exports the comments but it does not extract the tracked changes.

Code:
Sub CopyCommentsToExcel()
 'Create in Word vba
 Dim xlApp As Object
 Dim xlWB As Object
 Dim i As Integer
     On Error Resume Next
     Set xlApp = GetObject(, "Excel.Application")
     If Err Then
         Set xlApp = CreateObject("Excel.Application")
     End If
     On Error GoTo 0
     xlApp.Visible = True
     Set xlWB = xlApp.Workbooks.Add        ' create a new workbook
     With xlWB.Worksheets(1)
     ' Create Heading
        HeadingRow = 1
        .Cells(HeadingRow, 1).Formula = "ITEM NO."
        .Cells(HeadingRow, 2).Formula = "PAGE"
        .Cells(HeadingRow, 3).Formula = "REVIEWER"
        .Cells(HeadingRow, 4).Formula = "COMMENT"
        .Cells(HeadingRow, 5).Formula = "DATE"
        
         For i = 1 To ActiveDocument.Comments.Count
             .Cells(i + HeadingRow, 1).Formula = ActiveDocument.Comments(i).Index
             .Cells(i + HeadingRow, 2).Formula = ActiveDocument.Comments(i).Reference.Information(wdActiveEndAdjustedPageNumber)
             .Cells(i + HeadingRow, 3).Formula = ActiveDocument.Comments(i).Author
             .Cells(i + HeadingRow, 4).Formula = ActiveDocument.Comments(i).Range
             .Cells(i + HeadingRow, 5).Formula = Format(ActiveDocument.Comments(i).Date, "dd/MM/yyyy")
             .Cells(i + HeadingRow, 6).Formula = ActiveDocument.Comments(i).Range.ListFormat.ListString
         Next i
     End With
     Set xlWB = Nothing
     Set xlApp = Nothing
 End Sub

Last edited by macropod; 09-12-2018 at 02:27 PM. Reason: Added code tags & formatting