代表指定的投影片或投影片範圍上的註解。 Comment 物件是 Comments 集合物件的成員。
註解
使用下列屬性可存取註解資料:
| 屬性 | 描述 |
|---|---|
| Author | 作者的全名 |
| AuthorIndex | 註解清單中的作者索引 |
| AuthorInitials | 作者的縮寫 |
| DateTime | 註解的建立日期及時間 |
| Text | 註解的文字 |
| Left 、Top | 註解的螢幕座標 |
範例
使用 註解 (索引) , 其中索引 是評論的編號,或使用 Item 方法來存取投影片上的單一評論。 本範例會顯示第一張投影片上第一個註解的作者。 如果不有任何註解,就會顯示訊息,例如說明。
Sub ShowComment()
With ActivePresentation.Slides(1).Comments
If .Count > 0 Then
MsgBox "The first comment on this slide is by " & .Item(1).Author
Else
MsgBox "There are no comments on this slide."
End If
End With
End Sub
這個範例會顯示內含作者、日期和時間及第一張投影片上所有訊息內容的訊息。
Sub SlideComments()
Dim cmtExisting As Comment
Dim cmtAll As Comments
Dim strComments As String
Set cmtAll = ActivePresentation.Slides(1).Comments
If cmtAll.Count > 0 Then
For Each cmtExisting In cmtAll
strComments = strComments & cmtExisting.Author & vbTab & _
cmtExisting.DateTime & vbTab & cmtExisting.Text & vbLf
Next
MsgBox "The comments in your document are as follows:" & vbLf & strComments
Else
MsgBox "This slide doesn't have any comments."
End If
End Sub
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。