How to know if getElementById() return is complete. RRS feed

  • Question

  • Hi all

    How do I know if the collection I get with the getElementById function has already all items.

    Is there a property that I can check

    Here is my VBA (Excel 2007) code:

    Set wIE = New InternetExplorerMedium wIE.Visible = False URLNAV = "" wIE.navigate URLNAV Set hdocIE = wIE.document hdocIE.all.Item(74).Click Set SIelem = hdocIE.getElementById("results") '' just for testing MsgBox SIelem.all.Length Sleep 100 MsgBox SIelem.all.Length


    The question is that SIelem.all.Length can vary depending on the page.

    My remedy is to use the Sleep function and "calibrate" the time.
    But is not a good solution because the program becomes slow, sometimes waits too much and sometime has not enough wait time.


    Friday, July 25, 2014 8:52 AM