TypeText Method
TOC
Collapse the table of content
Expand the table of content

Selection.TypeText Method (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Inserts the specified text.

expression .TypeText(Text)

expression Required. A variable that represents a Selection object.

Parameters

Name

Required/Optional

Data Type

Description

Text

Required

String

The 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.

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

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

Options.ReplaceSelection = False 
With Selection 
 .TypeText Text:="Title" 
 .TypeParagraph 
End With
Show:
© 2016 Microsoft