export word review comments in excel

Anonymous
2010-10-08T09:36:15+00:00

Hi , I have several Review comments in my word documents, I wan to export all these comments to excel sheet.

If it is possible by macros, please guide me with step by step process.

Regards,

RG

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

45 answers

Sort by: Oldest
  1. Anonymous
    2013-01-23T14:50:46+00:00

    My original macro still works, but perhaps could do with changing to late binding thus:

    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)

            For i = 1 To ActiveDocument.Comments.Count

                .Cells(i, 1).Formula = ActiveDocument.Comments(i).Initial

                .Cells(i, 2).Formula = ActiveDocument.Comments(i).Range

                .Cells(i, 3).Formula = Format(ActiveDocument.Comments(i).Date, "dd/MM/yyyy")

            Next i

        End With

        Set xlWB = Nothing

        Set xlApp = Nothing

    End Sub

    The error relates to aldoDuke's addition of Function ParentLevel(Para As Word.Paragraph) As String which I have not evaluated.

    The first macro (no section references) works.  I would like to use the macro with section references.  still getting the error: Run-time error '91': Object variable or with block variable not set.

    It's a very helpful macro and thanks for all your help!

    Kaye

    Was this answer helpful?

    7 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-02-03T23:10:33+00:00

    Fantastic! Just what I was looking for and works perfectly for me. Thank you!

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-02-27T05:24:22+00:00

    My original macro still works, but perhaps could do with changing to late binding thus:

    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)

            For i = 1 To ActiveDocument.Comments.Count

                .Cells(i, 1).Formula = ActiveDocument.Comments(i).Initial

                .Cells(i, 2).Formula = ActiveDocument.Comments(i).Range

                .Cells(i, 3).Formula = Format(ActiveDocument.Comments(i).Date, "dd/MM/yyyy")

            Next i

        End With

        Set xlWB = Nothing

        Set xlApp = Nothing

    End Sub

    The error relates to aldoDuke's addition of Function ParentLevel(Para As Word.Paragraph) As String which I have not evaluated.

    The first macro (no section references) works.  I would like to use the macro with section references.  still getting the error: Run-time error '91': Object variable or with block variable not set.

     

    It's a very helpful macro and thanks for all your help!

     

    Kaye

    Fix for "error: Run-time error '91': Object variable or with block variable not set."

    just use the Do Until loop instead of Do While loop so that one iteration is reduced. It will look like -

    The Function will look like -

    Function ParentLevel(Para As Word.Paragraph) As String

    'From Tony Jollans

    ' Finds the first outlined numbered paragraph above the given paragraph object

    Dim ParaAbove As Word.Paragraph

    Set ParaAbove = Para

    'sStyle = Para.Range.ParagraphStyle

    sStyle = ParaAbove.Range.ParagraphStyle

    sStyle = Left(sStyle, 4)

    If sStyle = "Head" Then

    GoTo Skip

    End If

    Do Until ParaAbove.OutlineLevel = Para.OutlineLevel

    Set ParaAbove = ParaAbove.Previous

    Loop

    Skip:

    strTitle = ParaAbove.Range.Text

    strTitle = Left(strTitle, Len(strTitle) - 1)

    ParentLevel = ParaAbove.Range.ListFormat.ListString & " " & strTitle

    End Function

    Was this answer helpful?

    6 people found this answer helpful.
    0 comments No comments
  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  5. Anonymous
    2013-03-08T17:13:39+00:00

    I don't think the fix above from ShardulKulkarni works, for me it changed the behaviour so that  instead of getting a paragraph reference (e.g. 2.3.4 The Title), you get the whole text of the paragraph.

    I got this Error 91 when there was a comment on an object (like the title field) at the beginning of the document. I fixed it with the addition of an exit clause to the loop, that checks for a null previous paragraph. You end up with a reference of "General", which you could change if you want.

    Function ParentLevel(Para As Word.Paragraph) As String

     'From Tony Jollans

     ' Finds the first outlined numbered paragraph above the given paragraph object

         Dim ParaAbove As Word.Paragraph

         Set ParaAbove = Para

         sStyle = Para.Range.ParagraphStyle

         sStyle = Left(sStyle, 4)

         If sStyle = "Head" Then

             GoTo Skip

         End If

         Do While ParaAbove.OutlineLevel = Para.OutlineLevel

             Set ParaAbove = ParaAbove.Previous

             If (ParaAbove Is Nothing) Then

                 ParentLevel = "General"

                 Exit Function

             End If

         Loop

     Skip:

         strTitle = ParaAbove.Range.Text

         strTitle = Left(strTitle, Len(strTitle) - 1)

         ParentLevel = ParaAbove.Range.ListFormat.ListString & " " & strTitle

     End Function

    Was this answer helpful?

    4 people found this answer helpful.
    0 comments No comments