Results 1 to 4 of 4

Thread: WebBrowser/HTML question

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    I suppose you could use the SendKeys statement:
    Code:
    Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
        WebBrowser1.SetFocus
        SendKeys "^f", True 'popup the find dialog
        SendKeys "TheTextToSearchFor", True 'fill the dialog
        SendKeys "~", True 'do the first search
    End Sub
    Good luck!

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    If that doesn't work use this (you can make your own Find Dialog to fill in the Variables).

    Code:
    'Put an Internet Transfer Control (ITC) on your form
    MyString = Inet1.OpenUrl("MYURL")
    If Instr(1,MyString,"MYWORDTOSEEKFOR") <> 0 Then
    MsgBOx "Found!"
    Else
    MsgBOx "Not in here!"
    End If
    
    'If you want it CaseInsensitive use:
    MyString = Inet1.OpenUrl("MYURL")
    If Instr(1,Lcase(MyString),Lcase(MYWORDsTOSEEKFOR)) <> 0 Then
    MsgBOx "Found!"
    Else
    MsgBOx "Not in here!"
    End If
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    I just wanted to point out that you don't have to use LCase when you use InStr to do a search. Just simply set the forth argument to vbTextCompare instead.
    Code:
    If Instr(1, MyString, "MYWORDTOSEEKFOR", vbTextCompare) <> 0 Then
    Best regards

  4. #4
    Guest
    And Joacim's example works perfectly.

    But I also wanted to point out that Inet will not always get the whole web page. It's best to use the Webbrowser itself to get the source:

    Code:
    Text1.Text = Webbrowser1.Document.documentElement.innerHTML
    And then you can search for it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width