+ Reply to Thread
Results 1 to 3 of 3

getElementsByTagName - extract HTML from website

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    33

    getElementsByTagName - extract HTML from website

    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:

    Please Login or Register  to view this content.
    http://www.sportsbet.com.au/horse-ra...-1-585168.html

    Here is the macro I am trying to use to scrape it:

    Please Login or Register  to view this content.
    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?

    Cheers, Rob
    Last edited by killerkoz17; 02-19-2013 at 07:07 PM. Reason: better title

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: getElementsByTagName - extract HTML from website

    "price-box-str_56891231_L_W" is an id, not a tag, so getElementsByTagName won't work. Try getElementById.
    Post responsibly. Search for excelforum.com

  3. #3
    Registered User
    Join Date
    02-19-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: getElementsByTagName - extract HTML from website

    Thanks Chippy. That's exactly what I've done and it works now. For the record, the working code is:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1