Bookmark.ModifyEnclosure(Object, Object, Object) Method

Definition

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

public void ModifyEnclosure (ref object Style, ref object Symbol, ref object EnclosedText);
abstract member ModifyEnclosure : obj * obj * obj -> unit
Public Sub ModifyEnclosure (ByRef Style As Object, Optional ByRef Symbol As Object, Optional ByRef EnclosedText As Object)

Parameters

Style
Object

The style of the enclosure. Can be any WdEncloseStyle constant.

Symbol
Object

The symbol in which to enclose the Bookmark control. Can be any WdEnclosureType constant.

EnclosedText
Object

The characters that you want to enclose. If you include this argument, Microsoft Office Word replaces the Bookmark control with the enclosed characters. If you do not specify text to enclose, Microsoft Office Word encloses all text in the Bookmark control.

Examples

The following code example adds a Bookmark control to the first paragraph and encloses the third character in a circle.

This example is for a document-level customization.

private void BookmarkModifyEnclosure()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "First bookmark";

    object Style = Word.WdEncloseStyle.wdEncloseStyleLarge;
    object Symbol = Word.WdEnclosureType.wdEnclosureCircle;
    
    bookmark1.Characters[3].ModifyEnclosure(ref Style, ref Symbol, ref missing);
}
Private Sub BookmarkModifyEnclosure()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "First bookmark"

    Bookmark1.Characters(3).ModifyEnclosure( _
        Word.WdEncloseStyle.wdEncloseStyleLarge, _
        Word.WdEnclosureType.wdEnclosureCircle)

End Sub

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Applies to