moveToBookmark Method

Microsoft FrontPage Visual Basic

object has moved to the String specified in the Bookmark argument.

expression.moveToBookmark(Bookmark)

expression    Required. An expression that returns an IHTMLTxtRange object.

Bookmark    Required String.

Remarks

Use the getBookmark method to return the String for the Bookmark argument.

Example

The following example inserts two paragraphs into the active document and then modifies the contents of each paragraph.

Sub MoveToBookmarkMethod()
    Dim objRange As IHTMLTxtRange
    Dim strBookmark As String
    
    ActiveDocument.body.innerHTML = "<p>Line One</p><p>Line two</p>"

    Set objRange = ActiveDocument.body.createTextRange
    
    objRange.moveToElementText ActiveDocument.body.all.tags("p").Item(0)
    strBookmark = objRange.getBookmark
    
    With objRange
        .moveToElementText ActiveDocument.body.all.tags("p").Item(1)
        .Text = "Change Line 2"
        .moveToBookmark strBookmark
        .Text = "Change Line 1"
        .Select
    End With
End Sub