Results 1 to 7 of 7

Thread: browser component question

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    browser component question

    i know you can hook browsers into a window using the windows internet component etc.

    But is it possible to check if theres certain text on the page in this browser?

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: browser component question

    add a reference to the Microsoft Internt Controls

    VB Code:
    1. Dim WithEvents IE As InternetExplorer
    2. Private Sub Form_Load()
    3. Set IE = New InternetExplorer
    4. IE.Visible = True
    5. IE.Navigate "http://www.vbforums.com"
    6. End Sub
    7.  
    8. Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    9. If (pDisp Is IE.Application) Then
    10. Doc = IE.Document.Documentelement.innertext
    11.     If InStr(Doc, "Classic Visual Basic") Then
    12.         MsgBox "Its there!"
    13.         Debug.Print Doc
    14.     End If
    15. End If
    16. End Sub

    after u get the messagebox, look in your debug (Immediate) window.. all text will be there
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: browser component question

    thank you very much, but what do i change if i used the component on the form, instead of the references

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: browser component question

    thanks i just tried your code and it works. but it opens the actual webpage, is this possible to do using the webbrowser component instead?


    Thanks for all your help and replies so far, much appreciated.

  5. #5
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: browser component question

    sure

    remove the dim withevents IE line
    remove the Set IE = line
    change IE to the name of your webbrowser control
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: browser component question

    thanks alot mate, it works perfectly.

  7. #7
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: browser component question

    No problem! Glad to help

    (Mark the thread resolved go to the top -> Thread Tools ->Mark Resolved)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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