ShapeRange.TextEffect 属性 (Project)

获取形状区域的文本格式属性。 只读 TextEffectFormat

语法

表达式TextEffect

表达 一个代表“ShapeRange”对象的变量。

示例

以下示例创建一个包含文本框形状的形状区域,将文本框架中文本的前景色设置为红色,将文本框形状的前景色设置为淡黄色,然后使用 TextEffect 属性设置字体属性。

如果形状区域中有多个文本框形状,则会相应地更改每个文本框的字体属性。

Sub FormatTextBox()
    Dim theReport As Report
    Dim textShape As shape
    Dim reportName As String
    Dim sRange As ShapeRange
    
    reportName = "Textbox range report"
    
    Set theReport = ActiveProject.Reports.Add(reportName)
    Set textShape = theReport.Shapes.AddTextbox(msoTextOrientationHorizontal, 30, 50, 350, 80)
    textShape.Name = "My text box"
    
    textShape.TextFrame2.TextRange.Text = "This is a test. It's only a test. "
    textShape.TextFrame2.TextRange.Characters.Font.Fill.ForeColor.RGB = &H2020CC
    textShape.Fill.ForeColor.RGB = &H88CCCC
    
    Set sRange = theReport.Shapes.Range(Array("My text box"))
    
    With sRange.TextEffect
        .FontName = "Courier New"
        .FontBold = True
        .FontItalic = True
        .FontSize = 28
    End With
End Sub

属性值

TEXTEFFECTFORMAT

另请参阅

ShapeRange 对象Shape.TextEffect 属性TextEffectFormat

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。