The web page you are querying displays ads. My guess is that some of these ads (or any other randomly appearing <table>
) use <td>
elements before the ones you are looking for. The getElementsbyTagName()
method returns the first results it finds, so you won't get what you expect in this case.
I suggest replacing sDD = Trim(Doc.getElementsbyTagName("td")(2).innertext)
by something like:
Dim j As Integer
j = 2
Do
sDD = Trim(Doc.getElementsbyTagName("td")(j).innertext)
j = j + 1
Loop While sDD = "adchoices"
Edit the Loop While
condition until you can filter any ad-related result.
Hope it helps.