我想要一个文本框,其中第一行和后续文本行具有不同的格式,但它们必须位于同一文本框中。这就是我目前所拥有的,它将相同的格式应用于所有文本。
Sub geberateSlide()
...
With currSlide.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
Left:=0, Top:=0, Width:=headerWidth, Height:=headerHeight)
.TextFrame.TextRange.Text = "Test Box" & vbCrLf & "Description"
.TextFrame.AutoSize = ppAutoSizeNone
.Height = headerHeight
.Line.ForeColor.RGB = RGB(0,0,0)
.Line.Visible = True
End With
...
End Sub
文本应为Arial 8.第1行应为黑色和粗体,而后续文本应为蓝色。
答案 0 :(得分:3)
.TextFrame.TextRange.Lines(0, 1)
将定位第一行。
%300缩放
With currSlide.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
Left:=0, Top:=0, Width:=headerWidth, Height:=headerHeight)
.Height = headerHeight
.TextFrame.AutoSize = ppAutoSizeNone
With .TextFrame.TextRange
.Text = "Test Box" & vbCrLf & "Description"
With .Font
.Color = vbBlue
.Size = 8
.Name = "Arial"
End With
With .Lines(1).Font
.Color = vbBlack
.Bold = msoTrue
End With
End With
End With