This documentation is archived and is not being maintained.

TextRange.InsertAfter Method

Office 2007
Returns a TextRange object that represents text appended to the end of a text range.

Syntax

expression.InsertAfter(NewText)

expression   A variable that represents a TextRange object.

Parameters

NameRequired/OptionalData TypeDescription
NewTextRequiredStringThe text to be inserted.

Return Value
TextRange

Example

This example adds the Microsoft Office Publisher build number to the end of the first shape on the first page of the active publication. This example assumes the specified shape is a text frame and not another type of shape.

Visual Basic for Applications
Sub AppendText()
    With ActiveDocument.Pages(1).Shapes(1)
        .TextFrame.TextRange.InsertAfter _
            NewText:="Microsoft Publisher Build : " & Build
    End With
End Sub



Show: