Copying comments between documents

J

JD2

Hi Word Gurus,

Is there an easy way to copy all the comments in one Word document to
another Word document using Word 2007 (or Word 2003 if necessary)?

Kind Regards
JD2
 
G

Graham Mayor

You need a macro to copy from the current document to another e.g..

Sub ExtractComments()
Dim sDoc As Document
Dim tDoc As Document
Dim sLine As Integer
Dim sPage As Integer
Set sDoc = ActiveDocument
Set tDoc = Documents.Add
With sDoc
For i = 1 To .Comments.Count
.Comments(i).Reference.Select
sPage = Selection.Information(wdActiveEndPageNumber)
sLine = Selection.Information(wdFirstCharacterLineNumber)
If i = 1 Then
tDoc.Range.InsertAfter .Comments(i).Range.Text
Else
tDoc.Range.InsertAfter vbCr & .Comments(i).Range.Text
End If
tDoc.Range.InsertAfter " - Page " & _
sPage & ", Line " & sLine
Next i
End With
tDoc.Activate
End Sub

http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

Doug Robbins - Word MVP

If by "copy", you actually mean extract, then running a macro that contains
the following code when the document
containing the comments is the active document will create a new document
containing a table with the comments, the page number on which they appear
and the author's name:

Dim Source As Document, Target As Document
Dim TTable As Table
Dim TRow As Row
Dim acomment As Comment
Set Source = ActiveDocument
Set Target = Documents.Add
Set TTable = Target.Tables.Add(Target.Range, 1, 3)
With TTable.Rows(1)
.Cells(1).Range.Text = "Comment"
.Cells(2).Range.Text = "Page Number"
.Cells(3).Range.Text = "Author"
End With
For Each acomment In Source.Comments
Set TRow = TTable.Rows.Add
TRow.Cells(1).Range.Text = acomment.Range
acomment.Range.Select
TRow.Cells(2).Range.Text = Selection.Information(wdActiveEndPageNumber)
TRow.Cells(3).Range.Text = acomment.Author
Next acomment


--
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, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top