Add comment to PowerPoint by macro

1k views Asked by At

I have a rather good understanding of Excel Macros, but right now I would like to create something in PowerPoint. Unfortunately in PowerPoint 2013 there is no option of "Record macro", so that the initial steps I could record and tweak them. So please let me ask 2 particular things how to solve: 1. Add a comment to the current slide 2. Move this newly created comment somewhat up compared to its current location Thank you for any hints in advance. Kind regards, Balázs

1

There are 1 answers

0
Steve Rindsberg On

This will add a comment and optionally allow you to supply the Author name, initials and position. The initials part works, the name part seems not to. PPT always picks up the current user name, I think.

Sub Test()
    AddComment ActivePresentation.Slides(1), "This is the comment", "Abraham Lincoln", "AL"
End Sub

Sub AddComment(oSl As Slide, sText As String, _
    Optional sAuthor As String = "", _
    Optional sAuthorInitials As String = "XX", _
    Optional sngTop As Single = 100, Optional sngLeft As Single = 100)

    With oSl
        .Comments.Add sngLeft, sngTop, sAuthor, sAuthorInitials, sText
    End With

End Sub