2

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)

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
David
  • 21
  • 2
  • It's probably not very difficult - what have you tried so far? – Tim Williams Feb 10 '17 at 01:15
  • https://www.thespreadsheetguru.com/the-code-vault/2014/2/22/create-a-shape-or-text-box-and-format-it to get you started. You can add a button on the Quick Access Toolbar which will trigger a macro – Tim Williams Feb 10 '17 at 01:20
  • Do you have a macro recorder on your version of PowerPoint? If so start recording, Make your shape, format it and then stop recording. You can then add a button Just Like Tim said up above. Also there is a notes panel in PowerPoint that you may find will do the job as well. – excelledsoftware Feb 10 '17 at 03:10
  • Adding a comment doesn't work for you (it's on the Review tab in recent versions of PowerPoint). – Steve Rindsberg Feb 10 '17 at 19:20
  • Thanks Tim. This code is great and I could create a button in the quick access toolbar. However, the button doesn't work with other presentations. Do you know how I can create a macro that's usable across all presentations in PPT 2010? – David Feb 16 '17 at 13:30

1 Answers1

3

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
Ryan
  • 22,332
  • 31
  • 176
  • 357