Advertisement
Guest User

Untitled

a guest
Jun 16th, 2021
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. Sub GetInformation()
  2. Const Url = "https://filebin.varnish-software.com/li1h64qxrypyj8um/demo.html"
  3. Dim HTMLDoc As New HTMLDocument, I&, R&, oElem As MSHTML.IHTMLDOMChildrenCollection
  4.  
  5. R = 2
  6.  
  7. With CreateObject("MSXML2.XMLHTTP")
  8. .Open "GET", Url, False
  9. .setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
  10. .send
  11. HTMLDoc.body.innerHTML = .responseText
  12. End With
  13.  
  14. [A1:C1] = [{"Product Id"," Land Size","Total Main Area"}]
  15.  
  16. With HTMLDoc.getElementsByTagName("th")
  17. For I = 0 To .Length - 1
  18. If InStr(.item(I).innerText, "Quick Ref ID:") > 0 Then
  19. Cells(R, 1) = Trim(Application.WorksheetFunction.Clean(.item(I).ParentNode.LastChild.innerText))
  20. Exit For
  21. End If
  22. Next I
  23. End With
  24.  
  25. With HTMLDoc.querySelectorAll("th")
  26. For I = 0 To .Length - 1
  27. If InStr(.item(I).innerText, "Acreage") > 0 Then
  28. Cells(R, 2) = " " & .item(I).ParentNode.ParentNode.LastChild.getElementsByTagName("td")(2).innerText
  29. Exit For
  30. End If
  31. Next I
  32. End With
  33.  
  34. With HTMLDoc.querySelectorAll("tr")
  35. For I = 0 To .Length - 1
  36. If InStr(.item(I).innerText, "SQFT") > 0 Then
  37. Cells(R, 3) = .item(I).ParentNode.ParentNode.getElementsByTagName("tr")(1).LastChild.PreviousSibling.innerText
  38. Exit For
  39. End If
  40. Next I
  41. End With
  42. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement