Hi Forum,
I am new to Excel VBA (and this forum, please forgive any shortcomings) and I am trying to use Excel VBA 2010 to scrape some prices (2.40) from a horse racing website. This is the HTML I am trying to scrape:
http://www.sportsbet.com.au/horse-ra...-1-585168.html![]()
<span id="price-box-str_56891231_L_W" class="price_box_str"> 2.40 </span>
Here is the macro I am trying to use to scrape it:
I copied most of this macro from a YouTube video. Everything works except the parameter "price-box-str_56891231_L_W". I know this because when I use "body" instead, the correct information is returned. Could someone help me get this macro working?![]()
Sub SportsBetScraper() ' SportsBetScraper Macro Dim IE As Object Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True IE.Navigate Range("E4") Do DoEvents Loop Until IE.readyState = READYSTATE_COMPLETE Dim Doc As HTMLDocument Set Doc = IE.document Dim PriceData As String PriceData = Trim(Doc.getElementsByTagName("price-box-str_56891231_L_W")(0).innerText) MsgBox PriceData End Sub
Cheers, Rob
Bookmarks