返回一个 TextRange 对象,该对象代表除去结尾空格的指定文本。
expression.TrimText
expression 必选。该表达式返回一个 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