Project) (ShapeRange.TextEffect 属性

获取形状范围的文本格式属性。 只读 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 支持和反馈,获取有关如何接收支持和提供反馈的指南。