NativeExcel for .Net Developer's Reference

IRange.AddComment Method

Adds a comment to the cell and returns IComment interface.

Overload List

Adds a comment to the cell and returns IComment interface.

[Visual Basic] Function AddComment() As IComment
[C#] IComment AddComment();
[C++] IComment* AddComment();
[JScript] function AddComment(): IComment;

Adds a comment to the cell and returns IComment interface.

[Visual Basic] Function AddComment(ByVal String) As IComment
[C#] IComment AddComment(string);
[C++] IComment* AddComment(String*);
[JScript] function AddComment(String): IComment;

Example

The following example adds the comment to A1 cell.

[C#]
book.Worksheets[1].Range["A1"].AddComment("My comment");
[Visual Basic]
book.Worksheets(1).Range("A1").AddComment("My comment");
[C++]
book->Worksheets->Item[1]->Range->Item[S"A1"]->AddComment(S"My comment");
This example is the same as the previous.
[C#]
IComment c = book.Worksheets[1].Range["A1"].AddComment();
c.Text = "My comment";  
[Visual Basic]
Dim c As IComment = book.Worksheets(1).Range(1,1).AddComment()
c.Text = "My comment"
[C++]
IComment* c = book->Worksheets->Item[1]->Range->Item[1,1]->AddComment();
c->Text = S"My comment";

See Also

IRange Interface | NativeExcel Namespace