Hello!
I' m having issue finding elements in htlm code.
Here is my HTML code that i create to understand and test the getElementsByTagName method in VBA.
HTML Code:
<html>
<body>
<td> Id number </td>
<table>
<tr>
<td> Id number </td>
<td> Last name </td>
<td> First name </td>
<td> Number </td>
</tr>
<tr>
<td> Id number </td>
<td> Last name </td>
<td> First name </td>
<td> Number </td>
</tr>
</table>
</body>
</html>
Using this vba code:
Code:
conta = 0
Set elements = ie.Document.getElementsByTagName("body")
For Each element In elements
conta = conta + 1
Next element
MsgBox ("") & conta
I found 1 body element.
But if i try this one:
Code:
conta = 0
Set elements = ie.Document.getElementsByTagName("tr")
For Each element In elements
conta = conta + 1
Next element
MsgBox ("") & conta
The result is 0. Tried also to find the td elements and the result is 0.
Can't understand.
Wouldn't getElementsByTagName method give the collection of elements with the given tag present in the body?