Range.ModifyEnclosure method (Word)

Adds, modifies, or removes an enclosure around the specified character or characters.

Syntax

expression. ModifyEnclosure( _Style_ , _Symbol_ , _EnclosedText_ )

expression Required. A variable that represents a Range object.

Parameters

Name Required/Optional Data type Description
Style Required Variant The style of the enclosure. Can be any WdEncloseStyle constant.
Symbol Optional Variant The symbol in which to enclose the specified range. Can be any WdEnclosureType constant.
EnclosedText Optional Variant The characters that you want to enclose. If you include this argument, Microsoft Word replaces the specified range with the enclosed characters. If you don't specify text to enclose, Microsoft Word encloses all text in the specified range.

Example

This example replaces the current selection with the number 25 enclosed in a circle.

Selection.Range.ModifyEnclosure wdEncloseStyleLarge, _ 
 wdEnclosureCircle, "25"

See also

Range Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.