Comments 集合对象

         
多种对象
Comments (Comment)
Range

Comment 对象所组成的集合,该集合中的对象代表选定内容、区域或文档中的备注。

使用 Comments 集合

Comments 属性可返回一个 Comments 集合。下列示例显示 Don Funk 在活动文档中所做的备注。

ActiveDocument.ActiveWindow.View.SplitSpecial = wdPaneComments
ActiveDocument.Comments.ShowBy = "Don Funk"

Add 方法可在指定区域内添加备注。下列示例紧接着选定内容添加一条备注。

Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Comments.Add Range:=Selection.Range, _
    Text:="review this"

Comments(index) 可返回单个 Comment 对象,其中 index 是索引序号。索引序号代表该备注在选定内容、区域或文档中的位置。下列示例显示活动文档中第一个备注的作者。

MsgBox ActiveDocument.Comments(1).Author

下列示例显示选定内容中第一条备注的作者缩写。

If Selection.Comments.Count >= 1 Then MsgBox _
    Selection.Comments(1).Initial