1

I am trying to extract 5th child in the FDA node and then click on the IMG. My solution so far only extracts the 2nd element. Any help would be highly appreciated.

    <TD>Proxy to Inter</TD>
<TD>15/03/2017 7:19:18 AM</TD>
<TD>15/03/2017 7:19:18 AM</TD>
<TD>2</TD>
<TD>10</TD>
<TD>false</TD>
<TD></TD></TR>
<TR class=white><TD>FDA</TD>
<TD>Data</TD>
<TD>24/07/2017 1:21:59 PM</TD>
<TD>25/07/2017 9:42:43 AM</TD>
<TD>2</TD>
<TD>10</TD>
<TD>false</TD>
<TD><IMG onclick="Trail( style="CURSOR: hand" alt="" src="/images/task.gif"></TD></TR> 

My VBA code so far:

sText = ""

Found = False
Set inputCollection = HTMLDoc.getElementsByTagName("td")

  For Each inputElement In inputCollection

      If Found = True Then

          sText = inputElement.innerText
          Worksheets("Sheet1").Cells(sht1rw, 4) = sText
          Found = False
          Exit For

      End If
      If inputElement.innerText = "FDA" Then
          Found = True
      End If
    Next inputElement
  • HTML code you've provided has syntax and logical issue with it (i.e. it starts with a missing `<`). Can you either provide the full html code or a website address? Also, do you just want to click on the image where table row has **FDA**? – Zac Sep 08 '17 at 09:08
  • The website is on my organization's intranet so it's not publicly accessible. Sorry I can't post the entire code as my organization prohibits me from doing so. I want to put that child element's data on excel and then click on the image inside the FDA row. – user8268710 Sep 08 '17 at 09:29
  • Without a sample page it would be difficult to test any code. Saying that, here are a couple of things I found that might give you a good starting point: 1. https://www.mrexcel.com/forum/excel-questions/778416-vba-click-link-ie-table.html. 2. https://stackoverflow.com/questions/23728887/excel-vba-click-a-cell-in-a-table-controlled-by-javascript – Zac Sep 08 '17 at 10:25

0 Answers0