[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


IE and DOM - Need to know when ALL documents have finished loading...

Posted on 2006-04-25
Medium Priority
Last Modified: 2010-04-07
It seems like the document_complete event fires for every single document that is inside a parent document (I'm assuming documents in frames?).  I need to know when they all have finished loading.  Is there an easy way of doing this?  

Question by:scottmichael2
  • 2
  • 2
LVL 26

Expert Comment

ID: 16533604
are you using webbrowser control? if yes

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
if (pDisp = Webbrowser1) then
msgbox "all completed"
end if
End Sub

Author Comment

ID: 16534093
No, I'm automating IE with SHDocVw.InternetExplorer (creating a new IE Window, navigating to a page, and then displaying the IE Window to the user).

Here is the exact situation...

I am attempting to get the parent DOM from pop-ups that occur.  So I have an IE object for the pop-up (and instanciate it when the parent's NewWindow2 event fires).  At the time that this fires, not all child documents are loaded.  So, I'm wanting to wait until all of them are loaded (by "watching" the DocumentComplete event of the pop-up).  I need them all to be loaded (not just the parent) so I can show pieces of HTML from the entire IE Window (not just the parent).  

I thought that the NavigateComplete2 event would handle this, but it looks like not all documents are completely loaded when this fires.

I tried the code above and it doesn't seem to work for what I'm doing.  It displays the message 3 times before the page actually is fully loaded.

Any other suggestions?

LVL 26

Accepted Solution

EDDYKT earned 2000 total points
ID: 16534133

Author Comment

ID: 16538638
For whatever reason, only the combination of the two checks worked (the one that you specifically posted and the one in the article above).  Thanks very much for your help!  Scott

Featured Post

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.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

834 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