Skip to content
本页内容

Comment (对象)

代表单元格批注。

说明

Comment 对象是 Comments 集合的成员。

使用 Comment 属性可返回 Comment 对象。

示例

python
#本示例更改单元格 E5 中的批注文本
def test():
    Application.Worksheets.Item(1).Range("E5").Comment.Text("reviewed on " + Date())

使用 Comments(index)(其中 index 为批注号)可返回 Comments 集合中的单条批注。

python
#本示例隐藏第一张工作表中的第二条批注
def test():
    Application.Worksheets.Item(1).Comments.Item(2).Visible = False

使用 AddComment 方法可在区域内添加批注。

python
#本示例在第一张工作表的单元格 E5 中添加批注
def test():
    myComment = Application.Worksheets.Item(1).Range("E5").AddComment()
    myComment.Visible = False
    myComment.Text("reviewed on " + Date())