Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


mastering  WebBrowser1_DocumentComplete?

Posted on 2004-04-16
Medium Priority
Last Modified: 2008-03-03
Just wondering if I can tweek this code...
It works ok when running it live, but when I 'Step Into' during Debuggin, I get stuck in the loop...
I guess I would like to know why the DocumentComplete Event is not fired [or stepped into] during debuging?

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    pagefinished = 1
End Sub

Private Sub LetsGo()
    pagefinished = 0
    Call WebBrowser1.Navigate(sItem.href)
    Do While pagefinished = 0: DoEvents: Loop
End Sub

p.s. Gin Martinis are better than Vodka?...its friday!!! Cheers
Question by:williamsF1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 70

Accepted Solution

Éric Moreau earned 100 total points
ID: 10846965
That kind of event cannot be "step into". You can only place a breakpoint after the Loop.
LVL 17

Expert Comment

ID: 10847772
Instead of using a variable to flag when the document is complete, you could possible just check if the document is set or not which *should* work the same. Not completely sure though.

Private Sub Command1_Click()
    Call WebBrowser1.Navigate("http://www.yahoo.com")
    Do Until TypeName(WebBrowser1.Document) <> "Nothing"
    Call MsgBox("Finished downloading.")
End Sub

Author Comment

ID: 10853416
zzzzooc, this doesnt actuall wait for the document to be finished.
I try to set focus on an object and it fails as it hasn't been loaded yet. Sorry.

So I guess there is no other solution. Emoreau, you 100% sure on that?

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 70

Expert Comment

by:Éric Moreau
ID: 10853420
Yes that kind of events can't be traced.
LVL 17

Assisted Solution

zzzzzooc earned 100 total points
ID: 10853472

You could always just check the state of the WebBrowser.

Private Sub Form_Load()
    Me.Visible = True
    Call WebBrowser1.Navigate("http://www.downloads.com")
    Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
    Call MsgBox("Finished downloading.")
End Sub


LVL 70

Expert Comment

by:Éric Moreau
ID: 11255818
points to emoreau

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question