Getting Internet Explorer to Wait

AccessNub

Registered User.
Local time
Today, 05:45
Joined
Jul 22, 2006
Messages
71
It's been a while since I have been stumped, but I can't seem to get VBA IE to wait for the page.

Here is the issue:
Page loads, transaction is submitted, everything works fine 99% of the time, however, on occasion, the page loads a mini error page where you have to click a blue link for it to continue. Here is where I am stuck, if the blue link appears, I get an error that the object is not set, if I move my cursor up one row (For Each htmlInput) it will continue without error. How do I get IE to give the error message a chance to load before checking it out?

Code:
'click the SUBMIT button
For Each htmlInput In HTMLDoc.getElementsByTagName("Input")
        If htmlInput.Value = "Submit" Then
            htmlInput.Click
            Exit For
        End If
    Next htmlInput
    
  'look for the HERE link and click it

    Set HTMLDoc = pieMain.Document
    Set elem = HTMLDoc.getElementById("resultCode")
    
    If Not (elem Is Nothing) Then
    Set HTMLDoc = pieMain.Document
    For Each htmlInput In HTMLDoc.getElementsByTagName("A")
    If htmlInput.outerText = "here" Then  htmlInput.Click
    Next htmlInput
 

Users who are viewing this thread

Back
Top Bottom