Dear VBA GURUS,
I am trying to access to this websiteand I want to collect a few elements using data scrapping techniques on VBA. I want to collect a few fields (please see image)HTML Code:https://clinicaltrials.gov/ct2/show/NCT04134676
VBA problem.jpg
I am trying to run a code but this does not seem to be working and I really don't understand why. The error message I am getting is "Object variable or with block not set". The code is down below...Thank you once more for the help!
Option Explicit Sub CountryPopList() Dim IE As InternetExplorer Dim htmlEle As IHTMLElement Dim i As Integer i = 1 Set IE = New InternetExplorer IE.Visible = False IE.navigate "https://clinicaltrials.gov/ct2/show/NCT04134676" Application.Wait Now + TimeValue("00:00:05") For Each htmlEle In IE.document.getElementsByClassName("table.ct-data_table.tr-data_table")(0).getElementsByTagName("tr") With ActiveSheet .Range("A" & i).Value = htmlEle.Children(0).textContent .Range("B" & i).Value = htmlEle.Children(1).textContent .Range("C" & i).Value = htmlEle.Children(2).textContent End With i = i + 1 Next htmlEle End Sub