Reputation: 11
I want to add comments to a powerpoint presentation using VBA. I have this code using For loop but when I run the macro, the comment is adding to the whole presentation, i.e., all slides in the PPT. I wanted to add the comment to a selected slide. Can anyone help?
This is the code using For loop to add some comment:
Sub FictiousNames()
Dim mySlides As Slide
Dim cmtNew As Comment
For Each mySlides In ActivePresentation.Slides
Set cmtNew = mySlides.Comments.Add(Left:=12, Top:=12, _
Author:="Fictious Names", AuthorInitials:="", _
Text:="Please verify if this is an approved fictitious name. Also, you can use the following link to generate fictitious names: https://microsoft.sharepoint.com/sites/LCAWeb/Home/Copyrights-Trademarks-and-Patents/Trademarks/Fictitious-Names-Finder)"
Next mySlides
End Sub
Upvotes: 1
Views: 1386
Reputation: 33682
If you want to add a comment to a single (certain) slide, you don't need to use the For
loop, just copy the code below:
Sub FictiousNames()
' modify the number in brackets (9) to your slide number
ActivePresentation.Slides(9).Comments.Add 12, 12, "Fictious Names", "", _
"Please verify if this is an approved fictitious name. Also, you can use the following link to generate fictitious names: https://microsoft.sharepoint.com/sites/LCAWeb/Home/Copyrights-Trademarks-and-Patents/Trademarks/Fictitious-Names-Finder)"
End Sub
Upvotes: 2