List Comments Along With User IDs?

L

Lynne

Hello, folks,

There is a very nice macro that was posted here by Cindy Meister (THANK YOU,
CINDY!) that goes through a commented document and lists all its comments in
a separate document. Is there a way to tweak it to get it to show the user
IDs along with their comments?

We are using Word 2003 and Word 2007 (in Compatability Mode).

Here is Cindy's macro:

Sub ListCommentsInDoc()
Dim cmt As Word.Comment
Dim docSource As Word.Document
Dim docTarget As Word.Document
Dim rng As Word.Range

Set docSource = ActiveDocument
Set docTarget = Documents.Add
Set rng = docTarget.Range
rng.Text = "Comments in " & docSource.FullName & vbCr
rng.Style = wdStyleHeading1
rng.Collapse wdCollapseEnd
rng.Style = wdStyleNormal
For Each cmt In docSource.Comments
rng.Text = cmt.Range.Text & vbCr & vbC4
rng.Collapse wdCollapseEnd
Next
End Sub

Any help, greatly appreciated.

-Lynne
 
D

Doug Robbins - Word MVP

The following will arrange the comments and the author of each one in the
cells of a two column table. After the macro has run, you will probably
want to adjust the width of the columns to provide more space for the
comment and only just sufficient for the author.

Sub ListCommentsInDoc()
Dim cmt As Word.Comment
Dim docSource As Word.Document
Dim docTarget As Word.Document
Dim rng As Word.Range
Dim cmtTable As Table
Dim cmtRow As Row

Set docSource = ActiveDocument
Set docTarget = Documents.Add
Set cmtTable = docTarget.Tables.Add(docTarget.Range, 1, 2)
With cmtTable
.Cell(1, 1).Range.Text = "Comments in " & docSource.FullName
.Cell(1, 2).Range.Text = "User ID"
For Each cmt In docSource.Comments
Set cmtRow = .Rows.Add
With cmtRow
.Cells(1).Range.Text = cmt.Range.Text
.Cells(2).Range.Text = cmt.Author
End With
Next
End With
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
L

Lynne

Thank you so much--it works beautifully!

Doug Robbins - Word MVP said:
The following will arrange the comments and the author of each one in the
cells of a two column table. After the macro has run, you will probably
want to adjust the width of the columns to provide more space for the
comment and only just sufficient for the author.

Sub ListCommentsInDoc()
Dim cmt As Word.Comment
Dim docSource As Word.Document
Dim docTarget As Word.Document
Dim rng As Word.Range
Dim cmtTable As Table
Dim cmtRow As Row

Set docSource = ActiveDocument
Set docTarget = Documents.Add
Set cmtTable = docTarget.Tables.Add(docTarget.Range, 1, 2)
With cmtTable
.Cell(1, 1).Range.Text = "Comments in " & docSource.FullName
.Cell(1, 2).Range.Text = "User ID"
For Each cmt In docSource.Comments
Set cmtRow = .Rows.Add
With cmtRow
.Cells(1).Range.Text = cmt.Range.Text
.Cells(2).Range.Text = cmt.Author
End With
Next
End With
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

jerem

Can this be taken a little further? Any way of getting each comment
automatically out of the comment and into the text? I know when using
tracked changes it can be done.

Thanks.
 
D

Doug Robbins - Word MVP

Use:

Dim acom As Comment
With ActiveDocument
For Each acom In .Comments
With acom
.Reference.InsertAfter "[" & .Range & "]"
End With
Next
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

jerem

Works great. Thanks.

Doug Robbins - Word MVP said:
Use:

Dim acom As Comment
With ActiveDocument
For Each acom In .Comments
With acom
.Reference.InsertAfter "[" & .Range & "]"
End With
Next
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

jerem said:
Can this be taken a little further? Any way of getting each comment
automatically out of the comment and into the text? I know when using
tracked changes it can be done.

Thanks.
 
Top