Comments.Add Method

Word Developer Reference

Returns a Comment object that represents a comment added to a range.

Syntax

expression.Add(Range, Text)

expression   Required. A variable that represents a Comments collection.

Parameters

Name Required/Optional Data Type Description
Range Required Range object The range to have a comment added to it.
Text Optional Variant The text of the comment.

Return Value
Comment

Example

This example adds a comment at the insertion point.

Visual Basic for Applications
  Sub AddComment()
    Selection.Collapse Direction:=wdCollapseEnd
    ActiveDocument.Comments.Add _
        Range:=Selection.Range, Text:="review this"
End Sub

This example adds a comment to the third paragraph in the active document.

Visual Basic for Applications
  Sub Comment3rd()
    Dim myRange As Range
Set myRange = ActiveDocument.Paragraphs(3).Range
ActiveDocument.Comments.<strong class="bterm">Add</strong> Range:=myRange, _
    Text:="original third paragraph"

End Sub

See Also