Class Comments (Word VBA)
A collection of Comment objects that represent the comments in a selection, range, or document. To use a Comments class variable it first needs to be instantiated, for example
Dim cmms as Comments
Set cmms = Selection.Comments
Add
Returns a Comment object that represents a comment added to a range.
Sub AddComment()
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Comments.Add _
Range:=Selection.Range, Text:="review this"
End Sub
Arguments
The following argument is required
Range (Range) - The range to have a comment added to it.
Optional arguments
The following argument is optional
Text (String) - The text of the comment.
Count
Returns a Long that represents the number of items in the Comments collection.
Dim lngCount As Long
lngCount = Selection.Comments.Count
Item
Returns an individual Comment object in a collection.
Item (Index)
Index: The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.
Dim cmm As Comment
Set cmm = Selection.Comments(Index:=1)
ShowBy
Returns or sets the name of the reviewer whose comments are shown in the comments pane.
You can choose to show comments either by a single reviewer or by all reviewers. To view the comments by all reviewers, set this property to "All Reviewers."
If ActiveDocument.Comments.Count >= 1 Then
ActiveDocument.ActiveWindow.View.SplitSpecial = wdPaneComments
ActiveDocument.Comments.ShowBy = "Don Funk"
End If