Does anyone know how to do this? I've posted in some other tech forums but
no one seems to know. Even being able to select all of the comments
simultaneously and copying and pasting (to a new doc) would do. Also, could
it be that these comments are stored in an array somewhere?
Many thanks,
The following macro is an adaptation of one I posted for tracked changes at
http://groups.google.com/group/microsoft.public.word.docmanagement/msg/2188cc26e005fa03?hl=en.
See http://www.gmayor.com/installing_macro.htm if you need instructions.
Run the macro while one of your documents is open. It will create another
document containing a table, with a row for each comment showing date/time,
page number, line number, and the text of the comment. If you need it, it
would be possible to make the macro extract the formatted text of the
comment, the name of the person who made the comment, and several other bits
of information.
Sub ExportComments()
Dim srcDoc As Document, destDoc As Document
Dim oCom As Comment
Dim oTbl As Table
Dim nRows As Long
Set srcDoc = ActiveDocument
Set destDoc = Documents.Add
destDoc.Sections(1).Headers(wdHeaderFooterPrimary) _
.Range.Text = "Comments in " & _
srcDoc.FullName
Set oTbl = destDoc.Tables.Add(Range:=destDoc.Range, _
numrows:=1, numcolumns:=4)
nRows = 1
With oTbl
.Cell(1, 1).Range.Text = "Date & Time"
.Cell(1, 2).Range.Text = "Page"
.Cell(1, 3).Range.Text = "Line"
.Cell(1, 4).Range.Text = "Comment"
For Each oCom In srcDoc.Comments
.Rows.Add
nRows = nRows + 1
.Cell(nRows, 1).Range.Text = _
oCom.Date
.Cell(nRows, 2).Range.Text = oCom.Scope.Information( _
wdActiveEndAdjustedPageNumber)
.Cell(nRows, 3).Range.Text = oCom.Scope.Information( _
wdFirstCharacterLineNumber)
.Cell(nRows, 4).Range.Text = oCom.Range.Text
Next oCom
.Rows(1).HeadingFormat = True
End With
End Sub
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
<quote>
Sub ListAllComments()
'
' ListAllComments Macro
'
Dim doc As Word.Document
Dim docComments As Word.Document
Dim rng As Word.Range
Dim cmt As Word.Comment
Set doc = ActiveDocument
Set docComments = Documents.Add
Set rng = docComments.Range
For Each cmt In doc.Comments
rng.Text = cmt.Range.Text & vbCr
rng.Collapse wdCollapseEnd
Next cmt
End Sub
</quote>
It creates a new file containing all the comments in the original file.
--
Bob
http://www.kanyak.com