vb6 WebBrowser control

H

Harry

I use the following Code to find a special text in webbrowser document, not
by displaying a IE find dialog box.
but if HTML support Frame then I get the error (run-time error "438"). any
idea
how to fix this error.
Thanks,
Harry

Code:
Public myfindFirst As Boolean
Public oRange

Private Sub cmdFind_Click()
Dim sSearch As String
If myfindFirst Then
Set oRange = WebBrowser1.Document.body.createTextRange
sSearch = txtFind.Text
If oRange.FindText(sSearch) Then
oRange.Select
oRange.scrollIntoView
cmdFind.Caption = "Find Next"

myfindFirst = False
Else
MsgBox ("Search string " & txtFind.Text & " not found.")
End If
Else
Call oRange.Move("character")
sSearch = txtFind.Text
If oRange.FindText(sSearch) Then
oRange.Select
oRange.scrollIntoView
Else
MsgBox ("Finished searching Document for string " &
txtFind.Text)
cmdFind.Caption = "Find"
myfindFirst = True
Exit Sub
End If
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top