How to extract data from the internet by VBA

0

I'm trying to extract a specific table from a site and paste it into a worksheet to update a database on a daily basis. But as it is impossible to download the table as excel or csv, I should extract the table directly from the site.

Sub Daily()

'Create Internet Explorer Browser
Dim appIE As Object
Set appIE = CreateObject("internetexplorer.application")

'Ask Browser to navigate to website (.Visible=False will hide IE when running)
With appIE
    .Navigate "https://www.infomoney.com.br/mercados/ferramentas/contratos-di-futuro"
    .Visible = True
End With

'Have the macro pause while IE is busy opening and navigating
Do While appIE.Busy
    DoEvents
Loop

'Designate the table to be extracted and Copy the data from table - HERE



'Close IE and clear memory
appIE.Quit
Set appIE = Nothing

'Clear area and paste extracted text into the appropriate sheet/cells - HERE
Worksheets("Sheet1").Range("A2:H1000").ClearContents
Sheets("PPG").Select
Range("A2").Select
End Sub
    
asked by anonymous 03.01.2019 / 14:40

0 answers