PowerPoint) (TextRange.TrimText 方法
會傳回代表截去結尾空格之指定的文字的 TextRange 物件。
語法
expression。 TrimText
表達 代表 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
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。