TextRange.TrimText 方法 (PowerPoint)

返回表示减去任何尾随空格的指定的文本的 TextRange 对象。

语法

expressionTrimText

表达 一个代表 TextRange 对象的变量。

返回值

TextRange

示例

本示例在当前演示文稿中第一张幻灯片的第二个形状的文本的开始处插入字符串"Text to trim",然后显示消息框,该消息框中显示整理前和整理后的字符串。

With Application.ActivePresentation.Slides(1).Shapes(2) _
        .TextFrame.TextRange
    With .InsertBefore("   Text to trim   ")
        MsgBox "Untrimmed: " & """" & .Text & """"
        MsgBox "Trimmed: " & """" & .TrimText.Text & """"
    End With
End With

另请参阅

TextRange 对象

支持和反馈

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