如何创建黄色文本框?
How do you create a yellow text box?
如何创建黄色文本框?
我尝试了下面的方法,但我做不到
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
使用 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
如何创建黄色文本框?
我尝试了下面的方法,但我做不到 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
使用 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