Share via


Document.Comments Property (2007 System)

Gets a Comments collection that represents all the comments in the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Comments As Comments
'Usage
Dim instance As Document 
Dim value As Comments 

value = instance.Comments
[BrowsableAttribute(false)]
public Comments Comments { get; }
[BrowsableAttribute(false)]
public:
property Comments^ Comments {
    Comments^ get ();
}
public function get Comments () : Comments

Property Value

Type: Comments
A Comments collection that represents all the comments in the document.

Examples

The following code example adds text to the first paragraph and then adds a comment to the second word in the paragraph.

This example is for a document-level customization.

Private Sub DocumentComments()
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Paragraphs(1).Range.Text = "This is sample Text" 
    Dim commentText As Object = "This is comment text" 
    Me.Comments.Add(Me.Paragraphs(1).Range.Words(2), commentText)
End Sub
private void DocumentComments()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "This is sample Text";
    object commentText = "This is comment text";
    this.Comments.Add(this.Paragraphs[1].Range.Words[2], ref commentText);
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace