M
Matthew Leingang
Hello,
I'm reviewing and making comments on a number of long documents. The client
wants the comments in a separate document, though, so I thought I'd write a
macro to extract comments.
I want something like:
Page 2, Paragraph 3
This is a brilliant insight!
Page 4, Paragraph 5
Actually, this is false.
And so on...
So far I've got this:
--------
Public Sub CopyComments()
Dim i As Integer
Dim curDoc As Document
Dim newDoc As Document
Dim rng As Range
Dim cmt As Comment
Set curDoc = ActiveDocument
Set newDoc = Documents.Add
Set rng = newDoc.Range
For i = 1 To curDoc.Comments.Count
Set cmt = curDoc.Comments(i)
rng.InsertAfter ("PAGE: " & cmt.Scope.Information(wdActiveEndPageNumber)
& vbCr)
rng.InsertAfter ("SCOPE:" & cmt.Scope & vbCr)
rng.InsertAfter ("COMMENT: " & cmt.Range & vbCr & vbCr)
Next i
End Sub
--------
I saw the Information call used somewhere to get the page of the cursor
selection, so I thought it would adapt. Instead,
cmt.Scope.Information(wdActiveEndPageNumber) returns -1.
This is my first experience with VBA. Any clues?
TIA,
Matt
I'm reviewing and making comments on a number of long documents. The client
wants the comments in a separate document, though, so I thought I'd write a
macro to extract comments.
I want something like:
Page 2, Paragraph 3
This is a brilliant insight!
Page 4, Paragraph 5
Actually, this is false.
And so on...
So far I've got this:
--------
Public Sub CopyComments()
Dim i As Integer
Dim curDoc As Document
Dim newDoc As Document
Dim rng As Range
Dim cmt As Comment
Set curDoc = ActiveDocument
Set newDoc = Documents.Add
Set rng = newDoc.Range
For i = 1 To curDoc.Comments.Count
Set cmt = curDoc.Comments(i)
rng.InsertAfter ("PAGE: " & cmt.Scope.Information(wdActiveEndPageNumber)
& vbCr)
rng.InsertAfter ("SCOPE:" & cmt.Scope & vbCr)
rng.InsertAfter ("COMMENT: " & cmt.Range & vbCr & vbCr)
Next i
End Sub
--------
I saw the Information call used somewhere to get the page of the cursor
selection, so I thought it would adapt. Instead,
cmt.Scope.Information(wdActiveEndPageNumber) returns -1.
This is my first experience with VBA. Any clues?
TIA,
Matt