Sharid
Well-known Member
- Joined
- Apr 22, 2007
- Messages
- 1,064
- Office Version
- 2016
- Platform
- Windows
I am trying to get this link which is in a heading h2 but can not work it out
I though this would do it
Or this
But I can not work it out, can someone take a quick look please
Thanks
I though this would do it
VBA Code:
For Each div In HTMLdoc.getElementsByTagName("li")
If div.getAttribute("class") = "h2" Then
Set link = div.getElementsByTagName("a")(0)
.Cells(i, 1).Value = link.getAttribute("href")
i = i + 1
End If
Or this
VBA Code:
For Each link In HTMLdoc.getElementsByTagName("a")
If link.getAttribute("li class") = "h2" Then
Cells(i, 1).Value = link.getAttribute("href")
i = i + 1
End If
Next link
But I can not work it out, can someone take a quick look please
Thanks