![]() |
|
#3
|
||||
|
||||
|
Try:
Code:
Sub AnalyseComments()
Application.ScreenUpdating = False
Dim DocSrc As Document, DocTgt As Document, Tbl As Table, Rng As Range, r As Long
Set DocSrc = ActiveDocument
'Create a new document for the comments
Set DocTgt = Documents.Add
'Insert a 4-column table for the comments
With DocTgt
.Content = ""
Set Tbl = .Tables.Add(Range:=.Range, NumRows:=DocSrc.Comments.Count + 1, NumColumns:=4)
With Tbl
With .Rows(1)
.Range.Font.Bold = True
.Cells(1).Range.Text = "Page"
.Cells(2).Range.Text = "Comment scope"
.Cells(3).Range.Text = "Comment text"
.Cells(4).Range.Text = "Author"
End With
'Get info from each comment from DocSrc and insert in table
For r = 1 To .Rows.Count
With .Rows(r + 1)
'Page number
.Cells(1).Range.Text = DocSrc.Comments(r).Scope.Information(wdActiveEndPageNumber)
'The text marked by the comment
Set Rng = .Cells(2).Range
With Rng
.End = .End - 1
.FormattedText = DocSrc.Comments(r).Scope.FormattedText
End With
'The comment itself
Set Rng = .Cells(3).Range
With Rng
.End = .End - 1
.FormattedText = DocSrc.Comments(r).Range.FormattedText
End With
'The comment author
.Cells(4).Range.Text = DocSrc.Comments(r).Author
End With
Next
End With
.Activate
End With
Set DocSrc = Nothing: Set DocTgt = Nothing: Set Tbl = Nothing: Set Rng = Nothing
Application.ScreenUpdating = True
MsgBox "Finished creating comments document."
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| macro, vba, word macro |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VBA macro to change author name in tagged comments, then delete the tags | mjt | Word VBA | 0 | 01-28-2021 08:48 AM |
| Macro to highlight and bolden specific text in Word Comments | PCUSER | Word VBA | 1 | 09-22-2020 03:08 PM |
Formula to delete but maintain counts after the maximum has been reached
|
wheddingsjr | Excel | 2 | 01-03-2018 01:49 PM |
| Form won't maintain formatting | SBrant | Word | 0 | 02-10-2011 10:29 AM |
Maintain formatting while copying text from word, and pasting into a webpage.
|
kdogg121 | Word | 1 | 07-07-2009 02:50 AM |