共用方式為


WorksheetBase.Comments 屬性

取得 Microsoft.Office.Interop.Excel.Comments 集合,表示工作表上的所有註解。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

語法

'宣告
Public ReadOnly Property Comments As Comments
    Get
public Comments Comments { get; }

屬性值

型別:Microsoft.Office.Interop.Excel.Comments
Microsoft.Office.Interop.Excel.Comments 集合,表示工作表上的所有註解。

範例

下列程式碼範例會使用 Comments 屬性,分別顯示將註解加入儲存格 A1 之前和之後,目前工作表上的註解數目。

這是示範文件層級自訂的範例。

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 安全性

請參閱

參考

WorksheetBase 類別

Microsoft.Office.Tools.Excel 命名空間