Hi guys, below is the code I am currently using to pull data from a URL. It is pulling a value of one string however not the other one.
I have attached the sample workbook below for your information.
Any suggestions?
Sub Sample_test()
Dim IE As New InternetExplorer
Dim sht As Worksheet
Dim LastRow As Long
Dim rCell As Range
Dim rRng As Range
Dim sUrl As String
Dim ele As Object
Dim icoid As String
Dim des As String
Set sht = ThisWorkbook.Worksheets("Sheet1")
LastRow = sht.Cells(sht.Rows.Count, "B").End(xlUp).Row
Set rRng = sht.Range("B3:B" & LastRow)
For Each rCell In rRng.Cells
sUrl = rCell.Value
IE.navigate sUrl
Do While IE.Busy = True Or IE.readyState <> 4: DoEvents: Loop
For Each ele In IE.document.getElementsByClassName("tab-content")
On Error Resume Next
icoid = Trim(ele.Children(3).getElementsByClassName("col-md-6")(0).getElementsByTagName("table")(0).getElementsByTagName("tr")(0).getElementsByTagName("td")(0).innerText)
des = Trim(ele.Children(2).getElementsByClassName("col-md-6")(0).getElementsByClassName("col-12")(0).getElementsByTagName("table")(0).getElementsByTagName("tr")(0).getElementsByTagName("td")(0).innerText)
If Not Err Then
rCell.Offset(0, 1).Value = icoid
rCell.Offset(0, 2).Value = des
End If
On Error GoTo 0
Next ele
icoid = vbNullStrings
des = vbNullString
Next rCell
Set IE = Nothing
IE.Quit
End Sub
Bookmarks