This documentation is archived and is not being maintained.

Selection.TypeText Method

Office 2007
Inserts the specified text.



expression   Required. A variable that represents a Selection object.


NameRequired/OptionalData TypeDescription
TextRequiredStringThe text to be inserted.


If the ReplaceSelection property is True, the selection is replaced by the specified text. If ReplaceSelection is False, the specified text is inserted before the selection.


If Word is set so that typing replaces selected text, this example collapses the selection before inserting "Hello." This technique prevents existing document text from being replaced.

Visual Basic for Applications
If Options.ReplaceSelection = True Then
    Selection.Collapse Direction:=wdCollapseStart
    Selection.TypeText Text:="Hello"
End If

This example inserts "Title" followed by a new paragraph.

Visual Basic for Applications
Options.ReplaceSelection = False
With Selection
    .TypeText Text:="Title"
End With