DocumentBase.Comments Property
Gets a Comments collection that represents all the comments in the document.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
Syntax
'Declaration
Public ReadOnly Property Comments As Comments
public Comments Comments { get; }
Property Value
Type: Microsoft.Office.Interop.Word.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. To use this example, run it from the ThisDocument class in a document-level project.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.