I have this procedure to retrieve data from a website into Excel.
I can retrieve the info, but I need to select a drop down list to value 100.
I have tried lots of different possibilities without success.
It's the line with " ieObj.document.getElementById("earnings_announcements_earnings_table_length").Value = "100""
Anybody could point out the obvious that I might be missing ?
Thanks a lot.
I can retrieve the info, but I need to select a drop down list to value 100.
I have tried lots of different possibilities without success.
It's the line with " ieObj.document.getElementById("earnings_announcements_earnings_table_length").Value = "100""
Anybody could point out the obvious that I might be missing ?
Thanks a lot.
VBA Code:
Sub Zackstesting()
' declare the variables
Dim ieObj As InternetExplorer
Dim htmlEle As IHTMLElement
Dim i As Integer
Dim List As Object
Dim ie As Object
' initialize i to one
i = 1
' create and get access to an instance of IE
Set ieObj = New InternetExplorer
ieObj.Visible = False
ieObj.navigate "https://www.zacks.com/stock/research/AAPL/earnings-announcements"
' give the webpage some time to load all content
Application.Wait Now + TimeValue("00:00:05")
ieObj.document.getElementById("earnings_announcements_earnings_table_length").Value = "100"
' loop through all the rows in the table
For Each htmlEle In ieObj.document.getElementById("display dataTable no-footer")(1).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
.Range("D" & i).Value = htmlEle.Children(3).textContent
.Range("E" & i).Value = htmlEle.Children(4).textContent
.Range("F" & i).Value = htmlEle.Children(5).textContent
.Range("G" & i).Value = htmlEle.Children(6).textContent
End With
i = i + 1
Next htmlEle
End Sub