Extract Comments to New Document

If a document contains many comments (inserted via Review tab > New Comment), you may wish to get an overview of all the comments in one place. Here you will find both a macro and a free Word add-in that lets you extract all the comments to a new document.

Instead of installing the macro available on this page you may be interested in the ready-to-use add-in, DocTools ExtractData. Below, you can read about both the add-in and the macro.

Word add-in ready for use

DocTools ExtractData - a free add-in for Word

Word Add-In from DocTools

DocTools ExtractData is a Word add-in I provide for free. It lets you extract acronyms, bookmarks, tracked changes and comments.

The add-in works with Microsoft Word 2007 and newer versions on PC/Windows.

The add-in lets you easily extract the following types of data from the active document to a new document:

  • acronyms
  • bookmarks
  • tracked changes
  • comments

The extracted data, incl. additional metadata, will be listed in a table for easy overview.

DocTools ExtractData adds a set of tools to a custom tab, DocTools, in the Ribbon. The tools can be accessed from the group Extract Data in the DocTools tab. The DocTools tab may also contain tools from other add-ins provided by DocTools.

The result of extracting acronyms, tracked changes and comments are slightly improved versions of the results you get by using the free macros available on this website. The functionality for extracting bookmarks is available in the add-in only.

How to get the DocTools ExtractData add-in for free

Click the button below to learn more about DocTools ExtractData. You can download the add-in for free.

Macro solution

Read below if you want to use the macro instead of the add-in.

About the comments document that is created

The document with the extracted comments will include a header with the following information:

  • Full name of the document from which the comments were extracted
  • Name of the document creator
  • Creation date

The comments and metadata will be filled into a 5-column table. For each comment, the table will show:

  • Page number
  • The text that was commented (i.e. the scope)
  • The comment itself
  • Name of the author who inserted the comment
  • Date when the comment was added, date format dd-MMM-yyyy

See the illustration below.

Example of comments extracted to a new document

Note that you may need to change the table layout. Among other factors, the result will depend on your default table settings.

The macro

Below, you will find the macro code. If you need help on installing macros, see How to install a macro.

Public Sub ExtractCommentsToNewDoc()

    'Macro created 2007 by Lene Fredborg, DocTools - www.thedoctools.com
    'Revised October 2013 by Lene Fredborg: Date column added to extract
    'The macro creates a new document
    'and extracts all comments from the active document
    'incl. metadata
    'Minor adjustments are made to the styles used
    'You may need to change the style settings and table layout to fit your needs

    Dim oDoc As Document
    Dim oNewDoc As Document
    Dim oTable As Table
    Dim nCount As Long
    Dim n As Long
    Dim Title As String
    Title = "Extract All Comments to New Document"
    Set oDoc = ActiveDocument
    nCount = ActiveDocument.Comments.Count
    If nCount = 0 Then
        MsgBox "The active document contains no comments.", vbOKOnly, Title
        GoTo ExitHere
        'Stop if user does not click Yes
        If MsgBox("Do  you want to extract all comments to a new document?", _
                vbYesNo + vbQuestion, Title) <> vbYes Then
            GoTo ExitHere
        End If
    End If
    Application.ScreenUpdating = False
    'Create a new document for the comments, base on Normal.dotm
    Set oNewDoc = Documents.Add
    'Set to landscape
    oNewDoc.PageSetup.Orientation = wdOrientLandscape
    'Insert a 5-column table for the comments
    With oNewDoc
        .Content = ""
        Set oTable = .Tables.Add _
            (Range:=Selection.Range, _
            NumRows:=nCount + 1, _
    End With
    'Insert info in header - change date format as you wish
    oNewDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = _
        "Comments extracted from: " & oDoc.FullName & vbCr & _
        "Created by: " & Application.UserName & vbCr & _
        "Creation date: " & Format(Date, "MMMM d, yyyy")
    'Adjust the Normal style and Header style
    With oNewDoc.Styles(wdStyleNormal)
        .Font.Name = "Arial"
        .Font.Size = 10
        .ParagraphFormat.LeftIndent = 0
        .ParagraphFormat.SpaceAfter = 6
    End With
    With oNewDoc.Styles(wdStyleHeader)
        .Font.Size = 8
        .ParagraphFormat.SpaceAfter = 0
    End With

    'Format the table appropriately
    With oTable
        .Range.Style = wdStyleNormal
        .AllowAutoFit = False
        .PreferredWidthType = wdPreferredWidthPercent
        .PreferredWidth = 100
        .Columns.PreferredWidthType = wdPreferredWidthPercent
        .Columns(1).PreferredWidth = 5
        .Columns(2).PreferredWidth = 23
        .Columns(3).PreferredWidth = 42
        .Columns(4).PreferredWidth = 18
        .Columns(5).PreferredWidth = 12
        .Rows(1).HeadingFormat = True
    End With

    'Insert table headings
    With oTable.Rows(1)
        .Range.Font.Bold = True
        .Cells(1).Range.Text = "Page"
        .Cells(2).Range.Text = "Comment scope"
        .Cells(3).Range.Text = "Comment text"
        .Cells(4).Range.Text = "Author"
        .Cells(5).Range.Text = "Date"
    End With
    'Get info from each comment from oDoc and insert in table
    For n = 1 To nCount
        With oTable.Rows(n + 1)
            'Page number
            .Cells(1).Range.Text = _
            'The text marked by the comment
            .Cells(2).Range.Text = oDoc.Comments(n).Scope
            'The comment itself
            .Cells(3).Range.Text = oDoc.Comments(n).Range.Text
            'The comment author
            .Cells(4).Range.Text = oDoc.Comments(n).Author
            'The comment date in format dd-MMM-yyyy
            .Cells(5).Range.Text = Format(oDoc.Comments(n).Date, "dd-MMM-yyyy")
        End With
    Next n
    Application.ScreenUpdating = True
    MsgBox nCount & " comments found. Finished creating comments document.", vbOKOnly, Title

    Set oDoc = Nothing
    Set oNewDoc = Nothing
    Set oTable = Nothing
End Sub

Related information

See About VBA Macros and Code Snippets and How to Install a Macro for misc. information that may help you in your work with macros and for information about how to install macros.

For a macro that can extract tracked changes from the active document, see Extract Tracked Changes to New Document

For a macro that can extract ACRONYMS from the active document, see Extract ACRONYMS to New Document.

For detailed information about comments, see my article How comments in Word work on wordaddins.com.

Do you want to work more efficiently with comments in Word?
Learn what the Word add-in DocTools CommentManager can do for you

DocTools CommentManager lets you add automatic comment numbers, review comments in Word from one place, extract all comments with extra metadata compared to DocTools ExtractData, create inline comments for instructions and help, and much more.