创建加载项以在powerpoint(VBA)中添加便签

时间:2017-02-10 00:13:02

标签: vba powerpoint powerpoint-vba stickynote

我想为powerpoint创建一个简单的宏,它允许我点击一个按钮自动在我的幻灯片上插入一个黄色粘滞便笺,这样我就可以插入注释了。这是我在目前的工作中需要反复做的事情,现在我浪费了很多时间,每次创建一个矩形 - >着色它黄色 - >创建黑色轮廓 - >将字体颜色设置为红色,大小设置为12 ..

在这里感谢任何帮助,我知道这应该不是很难!

谢谢!

example of standard stickynote on a slide (at scale)

1 个答案:

答案 0 :(得分:1)

我为您写了这篇文章,希望对您有所帮助。

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