Updated Comments object in PowerPoint 2013
2013 updates the Comments object to offer more extensions. It has the new Add2, Replies and many other new properties. Add2 method allows you to programmatically add comments from other providers. You can flag the id for your live outlook or sharepoint account by specifying the correct information.
We will look at the example below which also makes use of a Windows Live user to assign the comment attributed to that user. Also, note that the replies are always at one level. So the top comment gets all the replies to it. If you specify the provider id and user id then it takes precendence over the Author information.
Also, if provider id and user id are not specified then those properties fail so make sure you have error handling while enumerating comments.
Supported versions: PowerPoint 2013
' -------------------------------------------------------------------------------- ' Copyright ©1999-2022, Shyam Pillai, All Rights Reserved. ' -------------------------------------------------------------------------------- ' You are free to use this code within your own applications, add-ins, ' documents etc but you are expressly forbidden from selling or ' otherwise distributing this source code without prior consent. ' This includes both posting free demo projects made from this ' code as well as reproducing the code in text or html format. ' --------------------------------------------------------------------------------Sub CommentsAddAndEnumerate() With ActivePresentation.Slides(1) With .Comments.Add2(0, 0, "User", "SKP", "This is example sucks", "None", "Shyam") 'Assign comment without credentials With .Replies.Add(100, 100, "Some user", "UB", "I agree") Call .Replies.Add2(100, 100, "", "UA", "I'll try to improve it", "None", "Shyam Pillai") End With 'Use a Windows Live as provider, use a valid user Id. This is just for representation. Call .Replies.Add2(100, 100, "", "", "It's alright.", "Windows Live", "02354654b39253ea0") End With Dim I As Long For I = 1 To .Comments.Count Call ListCommentInformation(.Comments(I)) Next End With End Sub Sub ListCommentInformation(comment As Comment) Dim I As Long On Error Resume Next With comment Debug.Print "Author: " & .Author Debug.Print "Author Index: " & .AuthorIndex Debug.Print "Author Initials: " & .AuthorInitials, Debug.Print "Date & Time: " & .DateTime Debug.Print "Is collapsed: " & .Collapsed Debug.Print "Text:" & .Text Debug.Print "Number of Replies:" & .Replies.Count Debug.Print "Provider Id:" & .ProviderID Debug.Print "User Id:" & .UserID If .Replies.Count > 0 Then For I = 1 To .Replies.Count Debug.Print "Reply no.: " & I Call ListCommentInformation(.Replies(I)) Next End If End With End Sub
|
Copyright 1999-2022 (c) Shyam Pillai. All rights reserved.