Share via


TextRange.TrimText Method

Returns a TextRange object that represents the specified text minus any trailing spaces.

Namespace:  Microsoft.Office.Interop.PowerPoint
Assembly:  Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)

Syntax

'Declaration
Function TrimText As TextRange
'Usage
Dim instance As TextRange
Dim returnValue As TextRange

returnValue = instance.TrimText()
TextRange TrimText()

Return Value

Type: Microsoft.Office.Interop.PowerPoint.TextRange
TextRange

Examples

This example inserts the string " Text to trim " at the beginning of the text in shape two on slide one in the active presentation and then displays message boxes showing the string before and after it is trimmed.

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

See Also

Reference

TextRange Interface

TextRange Members

Microsoft.Office.Interop.PowerPoint Namespace