Kamel Kamel - 7 months ago 60
HTML Question

Get text separate by <br></br> inside TD tag using VBA

I get the TD tag using this code

Set TDElement = oHtml.getElementsByTagName("tr")(6).getElementsByTagName("td")(18)


This return me the whole text of the TD tag.

Text1
Text2
Text3


what I want to do, is to get each separately string before the
<br></br>


This is the HTML page:

<td class="Td" nowrap="" valign="top">
text1<br></br>
text2<br></br>
text3<br></br>
</td>


How to iterate over this strings inside the TD tag

Answer

Something like....

    dim strSplit() as string
    dim intCounter as integer
    dim strSelection as string

    strHTML=replace(strHTML,"<br>","")
    strSplit=split(strHTML,"</br>")

    for intCounter=0 to ubound(strSplit)
        strSelection = strSplit(intCounter)
    next intCounter