Class Comment (Word VBA)

The class Comment represents a single comment. The Comment object is a member of the Comments collection. The Comments collection includes comments in a selection, range or document.

The main procedure of class Comment is Comments.Add

Set

To use a Comment class variable it first needs to be instantiated, for example

Dim cmm as Comment
Set cmm = Selection.Comments(Index:=1)

The following procedures can be used to set variables of type Comment: Ancestor, Comments.Add, Comments.Item, Replies, Document.Comments, Range.Comments and Selection.Comments

For Each

Here is an example of processing the Comment items in a collection.

Dim cmmReply As Comment
For Each cmmReply In Selection.Replies
	
Next cmmReply

Methods

This is the main method of the Comment class

Comments.Add - Returns a Comment object that represents a comment added to a range.

Dim cmm As Comment
Set cmm = Selection.Comments.Add(Range:=)

Properties

Ancestor for comments that are replies to existing comments, returns the parent Comment object; for new (top-level) comments, returns Nothing.

Dim cmmAncestor As Comment
Set cmmAncestor = Selection.Comments(1).Ancestor

Contact returns a CoAuthor object that represents the author of the specified comment.

Dim carContact As CoAuthor
Set carContact = Selection.Comments(1).Contact

Date returns a Date that represents the date and time that a comment was inserted.

Dim dtToday As Date
dtToday = Selection.Comments(1).Date

Done returns or sets a Boolean whose value is True if the specified comment has been marked closed.

Selection.Comments(1).Done = True

Index returns a Long that represents the position of an item in a collection.

Dim lngIndex As Long
lngIndex = Selection.Comments(1).Index

IsInk returns a Boolean that represents whether a comment is a handwritten comment.

Dim booIsInk As Boolean
booIsInk = Selection.Comments(1).IsInk

Parent returns an object that represents the parent object of the specified Comment object.

Dim objParent As Object
Set objParent = Selection.Comments(1).Parent

Range returns a Range object that represents the contents of a comment.

Dim rngRange As Range
Set rngRange = Selection.Comments(1).Range

Reference returns a Range object that represents a reference mark for a comment.

Dim rngReference As Range
Set rngReference = Selection.Comments(1).Reference

Replies returns a Comments collection of Comment objects that are children of the specified comment.

Dim cmmsReplies As Comments
Set cmmsReplies = Selection.Comments(1).Replies

Scope returns a Range object that represents the range of text marked by the specified comment.

Dim rngScope As Range
Set rngScope = Selection.Comments(1).Scope

Comments.Count returns a Long that represents the number of items in the Comments collection.

Dim lngCount As Long
lngCount = Selection.Comments.Count

Comments.Parent returns an object that represents the parent object of the specified Comments object.

Dim objParent As Object
Set objParent = Selection.Comments.Parent

Comments.ShowBy returns or sets the name of the reviewer whose comments are shown in the comments pane.

Selection.Comments.ShowBy =