如何创建黄色文本框?
我尝试了以下内容,但我无法做到这一点 a)在活动幻灯片中进行, b)变黄(可能带有一些格式为阴影) 谢谢
Sub sticky()
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
Left:=100, Top:=100, Width:=200, Height:=50).TextFrame _
.TextRange.Text = "Test Box"
End Sub
答案 0 :(得分:1)
使用ActiveWindow.Selection.SlideRange(1)代替ActivePresentation.Slides(1)通常会为您提供所需的幻灯片参考。
为初学者尝试一下:
Sub sticky()
' Use object variables for slide and shape
Dim oSl as Slide
Dim oSh as Shape
' Get a reference to the current slide
Set oSl = ActiveWindow.Selection.SlideRange(1)
' Add the shape and get a reference to it:
Set oSh = oSl.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
Left:=100, Top:=100, Width:=200, Height:=50)
With oSh
.TextFrame.TextRange.Text = "Test Box"
.Fill.ForeColor.RGB = RGB(255, 255, 0)
' Add any other formatting to the shape here
End With ' oSh ... the shape you added
End Sub