VBA functions are great when we need to do more with PowerPoint and Office documents. Yesterday I needed to copy the powerpoint comments for future reference and I came to the need to list comments using VBA.
Finally I ended using this code that will iterate through all your Slides and get your comments. The function add the author name, but you can omit this if it is not needed.
Set mySlides = ActivePresentation.Slides
For Each mySlide In mySlides
For Each myComment In mySlide.Comments
Comment = Comment & vbCrLf
Comment = Comment & “Author: ” & myComment.Author & “(” & myComment.DateTime & “)” & vbCrLf
Comment = Comment & “” & myComment.Text & vbCrLf
Afterword, you can open the Immediate Window (go to View -> Immediate Window or just press Ctrl-G) and click on Run to see your comments. Here in the immediate window you can copy and paste in your favorite text editor.
This can be good for example if you need to export your powerpoint slide’s comments to an output file.
Working with Slides objects in VBA let you do some smart operations like this one, for example if we need to embed the slide number as part of the comment we can use the Slide object in VBA and Comment Object. There are other useful properties besides Text and DateTime or Author name, for example if you need to know the comments coordinates in the slide: Left, Top or the AuthorInitials.