VBA code for Scrapping WSJ statements

monty12331

New Member
Joined
Jan 8, 2021
Messages
1
Office Version
  1. 365
Platform
  1. 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.

“Run time error “424”

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
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I would suggest you use Power Query/Get and Transform found on the Data Tab.

Data-->Get and Transform-->From Web

Insert URL and click on Transform when prompted. Then click on close and Load. It will load F/S
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,591
Members
449,174
Latest member
chandan4057

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top