主题
Next (方法)
返回一个 Comment 对象,该对象代表下一条批注。
说明
本方法仅对单张工作表有效。对工作表中最后一条批注使用本方法可返回 None(不是下一张工作表的第一条批注)。
在没有现有注释的新工作簿中测试此示例。 若要清除工作簿中的所有批注,请在“即时”窗格中使用 Selection.SpecialCells(xlCellTypeComments).Delete() 。
返回值
Comment
示例
python
#本示例隐藏下一条批注
def test():
# Sets up the comments
for xNum in range(1, 10):
Application.Range("A" + xNum).AddComment()
Application.Range("A" + xNum).Comment.Text("Comment " + xNum)
print("Comments created... A1:A10")
# Deletes every second comment in the A1:A10 range
for yNum in range(1, 10, 2):
Application.Range("A" + yNum).Comment.Next().Shape.Select(True)
Application.Selection.Delete()
print("Deleted every second comment")
python
#本示例显示 A3 单元格下一条批注的内容
def test():
print(Application.Range("A3").Comment.Next().Text())