Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Sorting Comments by Date.

Sorting Comments by Date

by Allen Wyatt
(last updated September 2, 2016)

1

Hamed has a document that has many different comments inserted throughout it. He would like to sort the comments by date so that he can get a view of how they were added to the document. He wonders if there is a way to do this.

There is no way to sort comments by date within a document. There are a couple of ways you can work around this, however, to get to what you want. The first way is to simply print the comments in the document. How you do this has been covered in other issues of WordTips. When you print the comments, they appear in the printout—automatically—in chronological order.

If you need more than a printout, however, you could also use a macro to extract all the comments and place them in a new document. The comments could be placed in the document in any order you desire, even chronologically. The following is an example of such a macro. It pulls the comments from your original document and places them in a table in a new document. The table is then sorted by date.

Sub ExtractComments()
    Dim oThisDoc As Document
    Dim oThatDoc As Document
    Dim oTable As Table
    Dim nCount As Long
    Dim n As Long

    On Error GoTo ExitHere

    Set oThisDoc = ActiveDocument

    ' get comment count
    nCount = ActiveDocument.Comments.Count

    ' Exit if there are no comments
    If nCount = 0 Then
        MsgBox "No comments in document"
        GoTo ExitHere
    End If

    Application.ScreenUpdating = False

    'Create a new document for the comments
    Set oThatDoc = Documents.Add

    'Set to landscape
    oThatDoc.PageSetup.Orientation = wdOrientLandscape

    'Insert a 5-column table for the comments
    Set oTable = oThatDoc.Tables.Add _
      (Range:=Selection.Range, _
      NumRows:=nCount + 1, NumColumns:=5)

    'Format the table appropriately
    With oTable
        .Range.Style = wdStyleNormal
        .AllowAutoFit = False
        .PreferredWidthType = wdPreferredWidthPercent
        .PreferredWidth = 110
        .Columns(1).PreferredWidth = 15
        .Columns(2).PreferredWidth = 5
        .Columns(3).PreferredWidth = 35
        .Columns(4).PreferredWidth = 35
        .Columns(5).PreferredWidth = 20
        .Rows(1).HeadingFormat = True
    End With

    'Insert table headings
    With oTable.Rows(1)
        .Range.Font.Bold = True
        .Cells(1).Range.Text = "Date"
        .Cells(2).Range.Text = "Page"
        .Cells(3).Range.Text = "Comment Scope"
        .Cells(4).Range.Text = "Comment"
        .Cells(5).Range.Text = "Author"
    End With

    'Get info from each comment from oThisDoc and insert in table
    For n = 1 To nCount
        With oTable.Rows(n + 1)
            .Cells(1).Range.Text = Format(oThisDoc.Comments(n).Date, _
              "m/d/yy h:m am/pm")
            .Cells(2).Range.Text = oThisDoc.Comments(n).Scope _
              .Information(wdActiveEndPageNumber)
            .Cells(3).Range.Text = oThisDoc.Comments(n).Scope
            .Cells(4).Range.Text = oThisDoc.Comments(n).Range.Text
            .Cells(5).Range.Text = oThisDoc.Comments(n).Author
        End With
    Next n

    ' Sort the table by date ascending
    oThatDoc.Tables(1).Select
    Selection.Sort ExcludeHeader:=True, FieldNumber:="Column 1", _
      SortFieldType:=wdSortFieldDate, SortOrder:=wdSortOrderAscending
    Selection.Collapse

    Application.ScreenUpdating = True
    Application.ScreenRefresh

    oThatDoc.Activate

ExitHere:
    Set oThisDoc = Nothing
    Set oThatDoc = Nothing
    Set oTable = Nothing
    On Error GoTo 0
End Sub

The above macro is a simplified and adapted version of a more complete macro written by Lene Fredborg, which can be found here:

http://www.thedoctools.com/index.php?show=mt_comments_extract

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11217) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Sorting Comments by Date.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Error Opening Second Workbook

If you try to open a second workbook and you see an error message, it could be because of the way you are opening the ...

Discover More

Edits Cause Text to Switch to Odd Fonts

If you have problems with strange fonts showing up when you paste information into a document, it is helpful to understand ...

Discover More

Disabling a Function Key

Function keys are used to perform common tasks in Excel. If you want to disable one of the function keys, it's rather easy to ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (menu)

Pop-up Comments

Want to see what a comment says just by moving the mouse? Here's how.

Discover More

Viewing Comments From a Specific Reviewer

If you have multiple editors (or authors) working on the same document, and each of them is adding comments, you may want to ...

Discover More

Adding Comments to Your Document

If you would like to add non-printing notes to your document, the Comments feature is one way of doing that. Here's how to ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 - 3?

2014-06-17 05:24:16

Chris

There is an addin that works on Word 2010/2013

http://geekswithblogs.net/cskardon/archive/2014/01/23/microsoft-word-comments-and-sorting-by-date.aspx


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.