Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exporting comments

0 views
Skip to first unread message

Havelock12

unread,
Sep 5, 2008, 9:04:01 AM9/5/08
to
I have a series of documents containing masses of comment balloons. I need to
take all of the information out of these comments for analysis. So I'm
looking for a way to export all of the comments at once, preferably to a
table in a new document.

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,

Jay Freedman

unread,
Sep 5, 2008, 11:52:21 AM9/5/08
to

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.


Havelock12

unread,
Sep 6, 2008, 8:08:05 PM9/6/08
to
That worked perfectly. Thanks!

WaggaRMP

unread,
Oct 14, 2008, 1:18:07 AM10/14/08
to
Havelock12
I'm having trouble replicating the code - for some reason I keep getting
eror messages when trying to run it - if you have it available from teh
Visual Basic Editor - could you please (pretty please) send it to me at
rpillow(at)csu.edu.au
many thanks
WaggaRMP

Opinicus

unread,
Oct 14, 2008, 1:30:14 AM10/14/08
to
This is a macro for doing this that was given to me by someone in one of
these groups:

<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

WaggaRMP

unread,
Oct 14, 2008, 1:54:12 AM10/14/08
to
Hi Opinicus - many thanks
0 new messages