Create add-in to add sticky notes in powerpoint (VBA)

1.7k Views Asked by At

I would like to create a simple macro for powerpoint that would allow me to click on one button to automatically insert a yellow sticky note onto my slide so I can insert a comment. This is something I need to do over and over in my current job and right now I am wasting a lot of time, each time creating a rectangle -> coloring it yellow -> creating a black outline -> setting font color to red and size to 12..

Appreciate any help here, I know it should not be very hard!

Thanks!

example of standard stickynote on a slide (at scale)

1

There are 1 best solutions below

0
On

I wrote this for you and hope it helps.

Sub insert_sticky_note()

    Dim mySlide As PowerPoint.Slide
    Dim myTextbox As PowerPoint.Shape

    Set mySlide = ActivePresentation.Slides(ActiveWindow.View.Slide.SlideNumber)

    Set myTextbox = mySlide.Shapes.AddTextbox(msoTextOrientationHorizontal, _
        Left:=0, Top:=10, Width:=200, Height:=50)

    myTextbox.Fill.BackColor.RGB = RGB(250, 246, 0) 'yellow
    myTextbox.Fill.Transparency = 0.2 'translucent
    myTextbox.Height = 150
    myTextbox.Width = 300
    myTextbox.TextFrame2.AutoSize = msoAutoSizeTextToFitShape 'https://www.pcreview.co.uk/threads/how-to-vba-code-shrink-text-on-overflow.3537036/#post-12183384

    With myTextbox.TextFrame.TextRange
        .Text = "Note"
        'With .Font
        '    .Size = 12
        '    .Name = "Arial"
        'End With
    End With
End Sub