다음을 통해 공유


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 네임스페이스