Share via


Bookmark.ModifyEnclosure Method

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

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

'Declaration
Sub ModifyEnclosure ( _
    ByRef Style As Object, _
    ByRef Symbol As Object, _
    ByRef EnclosedText As Object _
)
void ModifyEnclosure(
    ref Object Style,
    ref Object Symbol,
    ref Object EnclosedText
)

Parameters

  • EnclosedText
    Type: System.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.

Remarks

Optional Parameters

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

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 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
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);
}

.NET Framework Security

See Also

Reference

Bookmark Interface

Microsoft.Office.Tools.Word Namespace