monty12331
New Member
- Joined
- Jan 8, 2021
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Dear All,
I was wondering if some can assist me in scrapping financial statements from WSJ on excel. I am a beginner in VBA and through watching videos I have manage to write the following code to extract financial statement from WSJ. But when I run the code, the internet explorer with the website opens but data is not extracted. Instead following message appears.
Here is the code I wrote
Sub finanacialdata()
Dim ieobj As InternetExplorer
Dim htmlele As IHTMLElement
Dim i As Integer
i = 1
Set ieobj = New InternetExplorer
ieobj.Visible = True
ieobj.navigate "GOL | GOL Linhas Aereas Inteligentes S.A. ADR Annual Balance Sheet - WSJ"
Application.Wait Now + TimeValue("00.00.10")
For Each htmlele In ie.obj.document.getElementsByClassName("zonedmodule")(0).getElementBytagname("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
End With
i = i + 1
Next htmlele
End Sub
Thanks
I was wondering if some can assist me in scrapping financial statements from WSJ on excel. I am a beginner in VBA and through watching videos I have manage to write the following code to extract financial statement from WSJ. But when I run the code, the internet explorer with the website opens but data is not extracted. Instead following message appears.
“Run time error “424”
Object Required”
Object Required”
Here is the code I wrote
Sub finanacialdata()
Dim ieobj As InternetExplorer
Dim htmlele As IHTMLElement
Dim i As Integer
i = 1
Set ieobj = New InternetExplorer
ieobj.Visible = True
ieobj.navigate "GOL | GOL Linhas Aereas Inteligentes S.A. ADR Annual Balance Sheet - WSJ"
Application.Wait Now + TimeValue("00.00.10")
For Each htmlele In ie.obj.document.getElementsByClassName("zonedmodule")(0).getElementBytagname("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
End With
i = i + 1
Next htmlele
End Sub
Thanks