PDA

View Full Version : help with html extraction



neeeel
06-24-2011, 01:41 PM
there is a bit of code I have written, which works on my pc, but doesnt work on someone elses. I am really confused.the code in question is

Dim temp as HtmlHtmlElement
dim s as string
s = "2222222"
For Each temp In html.getElementsByTagName("option")
If temp.getAttribute("value") = s Then
r.Offset(0, 1) = (temp.innerText)
End If
Next temp
r is a range object that is passed to the sub.
the variable html is an object that has been loaded with html from a webpage.

This code works fine on my pc, it finds the "option" tags in the html source , and then checks to see if the "value" attribute is equal to the string s. When I run it on someone elses pc , temp.getAttribute("value") returns a blank string, even though there is an attribute called value. The web page address is hard coded so its not that hes using the wrong URL
I use excel 2007, he uses 2010

Anyone got any ideas?
thanks

Bob Phillips
06-25-2011, 01:43 AM
What's the URL?

neeeel
06-25-2011, 05:31 AM
an example of the url is
http://www.racingpost.com/horses/horse_home.sd?race_id=533618&r_date=2011-06-25&horse_id=774727