ContentControl.SetPlaceholderText Method (Word)

Sets the placeholder text that displays in the content control until a user enters their own text.

Syntax

expression .SetPlaceholderText(BuildingBlock, Range, Text)

expression An expression that returns a ContentControl object.

Parameters

Name

Required/Optional

Data Type

Description

BuildingBlock

Optional

BuildingBlock

Specifies a BuildingBlock object that contains the contents of the placeholder text.

Range

Optional

Range

Specifies a Range object that contains the contents of the placeholder text.

Text

Optional

String

Specifies the contents of the placeholder text.

Remarks

Only one of the parameters is used when specifying placeholder text. If more than one parameter is used, Microsoft Word uses the text specified in the first parameter. If all parameters are omitted, the placeholder text is blank.

Example

The following example inserts a new drop-down list content control into the active document, sets the title and placeholder text, and then inserts several new items into the list.

Dim objCC As ContentControl 
Dim objMap As XMLMapping 
 
Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList) 
objCC.Title = "My Favorite Animal" 
objCC.SetPlaceholderText , , "Select your favorite animal " 
 
'List entries 
objCC.DropdownListEntries.Add "Cat" 
objCC.DropdownListEntries.Add "Dog" 
objCC.DropdownListEntries.Add "Horse" 
objCC.DropdownListEntries.Add "Monkey" 
objCC.DropdownListEntries.Add "Snake" 
objCC.DropdownListEntries.Add "Other"

See Also

Concepts

ContentControl Object

ContentControl Object Members