主题
Comments (对象)
由单元格批注组成的集合。
说明
每个批注都由一个 Comment 对象代表。
使用 Comments 属性可返回 Comments 集合。
示例
python
#本示例隐藏第一张工作表上的所有批注
def test():
cmt = Application.Worksheets.Item(1).Comments
for c in range(1, cmt.Count):
cmt.Item(c).Visible = False
使用 AddComment 方法可在区域内添加批注。
python
#本示例在第一张工作表的单元格 E5 上添加一个批注
def test():
myComment = Application.Worksheets.Item(1).Range("E5").AddComment()
myComment.Visible = False
myComment.Text("reviewed on " + Date())
使用 Comments(index)(其中 index 为批注号)可返回 Comments 集合中的单条批注。
python
#本示例隐藏第一张工作表上的第二个批注
def test():
Application.Worksheets.Item(1).Comments.Item(2).Visible = False