WorksheetBase.Comments-Eigenschaft

Ruft eine Microsoft.Office.Interop.Excel.Comments-Auflistung ab, die alle Kommentare für das Arbeitsblatt darstellt.

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; }

Eigenschaftswert

Typ: Microsoft.Office.Interop.Excel.Comments
Eine Microsoft.Office.Interop.Excel.Comments-Auflistung, die alle Kommentare für das Arbeitsblatt darstellt.

Beispiele

Im folgenden Codebeispiel wird mithilfe der Comments-Eigenschaft die Anzahl der Kommentare im aktuellen Arbeitsblatt angezeigt, bevor und nachdem der Zelle A1 ein Kommentar hinzugefügt wurde.

Dieses Beispiel bezieht sich auf eine Anpassung auf Dokumentebene.

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-Sicherheit

Siehe auch

Referenz

WorksheetBase Klasse

Microsoft.Office.Tools.Excel-Namespace