Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub GetInformation()
- Const Url = "https://filebin.varnish-software.com/li1h64qxrypyj8um/demo.html"
- Dim HTMLDoc As New HTMLDocument, I&, R&, oElem As MSHTML.IHTMLDOMChildrenCollection
- R = 2
- With CreateObject("MSXML2.XMLHTTP")
- .Open "GET", Url, False
- .setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
- .send
- HTMLDoc.body.innerHTML = .responseText
- End With
- [A1:C1] = [{"Product Id"," Land Size","Total Main Area"}]
- With HTMLDoc.getElementsByTagName("th")
- For I = 0 To .Length - 1
- If InStr(.item(I).innerText, "Quick Ref ID:") > 0 Then
- Cells(R, 1) = Trim(Application.WorksheetFunction.Clean(.item(I).ParentNode.LastChild.innerText))
- Exit For
- End If
- Next I
- End With
- With HTMLDoc.querySelectorAll("th")
- For I = 0 To .Length - 1
- If InStr(.item(I).innerText, "Acreage") > 0 Then
- Cells(R, 2) = " " & .item(I).ParentNode.ParentNode.LastChild.getElementsByTagName("td")(2).innerText
- Exit For
- End If
- Next I
- End With
- With HTMLDoc.querySelectorAll("tr")
- For I = 0 To .Length - 1
- If InStr(.item(I).innerText, "SQFT") > 0 Then
- Cells(R, 3) = .item(I).ParentNode.ParentNode.getElementsByTagName("tr")(1).LastChild.PreviousSibling.innerText
- Exit For
- End If
- Next I
- End With
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement