Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88087

VBA HTML elements to Excel

$
0
0

I am working on a code that uses VBA-Excel to navigate to a website and copy some values to Excel.

I can open the website and navigate, but I can't save the "Precipitation" values in excel sheet

Sub accuweather()

Dim ie As InternetExplorer
Dim pagePiece As Object
Dim webpage As HTMLDocument

Set ie = New InternetExplorer
ie.Visible = True 

ie.navigate ("http://www.accuweather.com/en/pt/abadia/869773/daily-weather-forecast/869773?day=2")

Do While ie.readyState = 4: DoEvents: Loop
Do Until ie.readyState = 4: DoEvents: Loop

While ie.Busy
    DoEvents
Wend

Set webpage = ie.document
Set mtbl = webpage.getElementsByTagName("details-card card panel details allow-wrap")
Set table_data = mtbl.getElementsByTagName("div")(1)

For itemNum = 1 To 240
    For childNum = 0 To 5
        Cells(itemNum, childNum + 1) = table_data.Item(itemNum).Children(childNum).innerText
    Next childNum
Next itemNum

ie.Quit
Set ie = Nothing

End Sub

Viewing all articles
Browse latest Browse all 88087

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>