getBookmark Method

Microsoft FrontPage Visual Basic

object.

expression.getBookmark

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

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

Sub MoveToBookmarkMethod2()
    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 = "Changed Line 2"
        .moveToBookmark strBookmark
        .Text = "Changed line 1"
        .Select
    End With
    
    Set objRange = Nothing
End Sub