Results 1 to 6 of 6

Thread: Web Browser Question

  1. #1
    Guest

    Question

    DOes anyone know how to control the webbrowser control such that it only executes a command/statement once?

    DocumentComplete, DownloadComplete and NavigateComplete2 seem to execute more than one time.

    What I want to do is once the webbrowser has finished loading, it executes another instruction only once.

    Any help is appreciated..

  2. #2
    Guest
    All DocumentComplete, DownloadComplete and NavigateComplete2 are pretty much the same. Try putting your code in just one, choose one, doesn't really matter which one and it will only execute once.

  3. #3
    Guest

    4 times

    Yes, i did try in with document_complete:

    Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

    Debug.Print "yes"

    End Sub

    It's printing "yes" four times in the intermediate windows, depending on the web source , sometimes three times, twice, etc.

    Dunno why?

  4. #4
    Guest
    Try switching it to a different event. Try them all.

    Or you could...have a Boolean and if it's True, than you will only do it once..if false, than it hasn't been done yet. If you need help on doing this, just ask.

  5. #5
    Guest

    already tried

    Originally posted by Matthew Gates
    Try switching it to a different event. Try them all.

    Or you could...have a Boolean and if it's True, than you will only do it once..if false, than it hasn't been done yet. If you need help on doing this, just ask.
    I've tried using the other events, but the statement is still being executed more than once.

    I've also tried using boolean:

    Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

    If flag = 0 Then
    Debug.Print "yes"
    flag = 1
    End If

    End Sub

    but, it's still being executed more than once , I really don't get this....

  6. #6
    Guest
    That's weird, and you only have code in the Webbrowser1_DocumentComplete event?

    Because it only fires once for me. I don't have anything DownloadComplete or NavigateComplete2 events, just DocumentComplete.

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