Word.Tips.Net WordTips (Menu Interface)

Sorting Comments by Date

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.

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 _
            .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
    Selection.Sort ExcludeHeader:=True, FieldNumber:="Column 1", _
      SortFieldType:=wdSortFieldDate, SortOrder:=wdSortOrderAscending

    Application.ScreenUpdating = True


    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:


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.

Related Tips:

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!


Leave your own comment:

  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*What is 5+3 (To prevent automated submissions and spam.)
           Commenting Terms

Comments for this tip:

Chris    17 Jun 2014, 05:24
There is an addin that works on Word 2010/2013



Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us


Advertise with Us

Our Privacy Policy

Our Sites


Beauty and Style




DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)



Home Improvement

Money and Finances


Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives


Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2016 Sharon Parq Associates, Inc.