次の方法で共有


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 名前空間