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
3
  • 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? Commented Sep 8, 2017 at 9: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. Commented Sep 8, 2017 at 9: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. mrexcel.com/forum/excel-questions/…. 2. stackoverflow.com/questions/23728887/… Commented Sep 8, 2017 at 10:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.