3

我想要一个文本框,其中第一行和后续文本行具有不同的格式,但它们必须在同一个文本框中。这是我目前拥有的,它将相同的格式应用于所有文本。

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 行应为黑色和粗体,而后续文本应为蓝色。

4

1 回答 1

5

.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
于 2016-11-14T02:36:31.093 回答