WorksheetBase.Comments Property
Gets a Comments collection that represents all the comments for the worksheet.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
Public ReadOnly Property Comments As Comments
public Comments Comments { get; }
Property Value
Type: Comments
A Comments collection that represents all the comments for the worksheet.
Examples
The following code example uses the Comments property to display the number of comments on the current worksheet before and after adding a comment to cell A1.
This example is for a document-level customization.
Private Sub GetCommentsCount()
MsgBox("Before adding a comment, there are " & _
Me.Comments.Count & " comments in the worksheet.")
Me.Range("A1").AddComment( _
("This is a comment for cell" & " A1"))
MsgBox("After adding a comment, there are " & _
Me.Comments.Count & " comments in the worksheet.")
End Sub
private void GetCommentsCount()
{
MessageBox.Show("Before adding a comment, there are " +
this.Comments.Count + " comments in the worksheet.");
this.Range["A1", missing].AddComment("This is a comment for cell" +
" A1");
MessageBox.Show("After adding a comment, there are " +
this.Comments.Count + " comments in the worksheet.");
}
.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.