Extracting the MS Word comments of a specific reviewer to Excel

dpkdileep

New Member
Joined
Jul 27, 2019
Messages
7
Hello,

I am trying to create a macro to extract the comments made by a specific reviewer in word.
I need the results in an excel table where one column should show the page number of word, other column should show the original selected content (for the comment), and another column should show the comment given by the reviewer.

After much research I could extract the comments from word, but I am not able to extract the comments of one particular reviewer.

Please help.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Try this, editing the code where indicated.

VBA Code:
Public Sub Extract_Word_Comments()

    Dim wApp As Object
    Dim wDoc As Object
    Dim wComment As Object
    Dim WordFile As String
    Dim Reviewer As String
    
    WordFile = "C:\path\to\Word document.docx"  'CHANGE THIS
    Reviewer = "YourReviewer" 'CHANGE THIS

    Set wApp = CreateObject("Word.Application")
    Set wDoc = wApp.Documents.Open(fileName:=WordFile, ReadOnly:=True)
    wApp.Visible = True

     For Each wComment In wDoc.Comments
        'Check comment author
        If StrComp(Reviewer, wComment.Author, vbTextCompare) = 0 Then
            'Page number
            Debug.Print wComment.Scope.Information(3) 'wdActiveEndPageNumber
            'The text marked by the comment
            Debug.Print wComment.Scope
            'The comment itself
            Debug.Print wComment.Range.Text
        End If
    Next
   
    wDoc.Close SaveChanges:=False
    wApp.Quit

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top