SQUIDD
Well-known Member
- Joined
- Jan 2, 2009
- Messages
- 2,126
- Office Version
- 2019
- 2016
- Platform
- Windows
Hello
I need to get the data from this webpage
Meeting Results
in a specific layout
if you see there are 12 races on this page.
so i would like 12 lines of data as setout below. I have given the class names as help
"track", "grade", "date", "datetime", "essential greyhound" 1-6(in trap order if possible), "first essential fin" 1-6, "sp" 1-6
I can actually do the above, but my problems come when in some races, perhaps non runners means that maybe only 5 runners, then all of my code goes wrong. I ma not able to account for the numbers going out of sync.
part of my code below so you can see my approach.
BTW, dont have to use ie, but i dont know any other way.
Thanks for looking, its doing my head in.
Dave[TABLE="width: 1654"]
<colgroup><col style="width:68pt" width="90"> <col style="width:32pt" width="42"> <col style="width:57pt" width="76"> <col style="width:30pt" width="40"> <col style="width:37pt" width="49"> <col style="width:39pt" width="52"> <col style="width:95pt" width="126"> <col style="width:98pt" width="131"> <col style="width:95pt" width="126"> <col style="width:93pt" width="124"> <col style="width:96pt" width="128"> <col style="width:89pt" width="118"> <col style="width:36pt" width="48" span="6"> <col style="width:33pt" width="44" span="6"> </colgroup><tbody>[TR]
[TD="width: 42"][/TD]
[TD="width: 76"][/TD]
[TD="width: 40"][/TD]
[TD="width: 49"][/TD]
[TD="width: 52"][/TD]
[TD="width: 126"][/TD]
[TD="width: 131"][/TD]
[TD="width: 126"][/TD]
[TD="width: 124"][/TD]
[TD="width: 128"][/TD]
[TD="width: 118"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[/TR]
</tbody>[/TABLE]
I need to get the data from this webpage
Meeting Results
in a specific layout
if you see there are 12 races on this page.
so i would like 12 lines of data as setout below. I have given the class names as help
"track", "grade", "date", "datetime", "essential greyhound" 1-6(in trap order if possible), "first essential fin" 1-6, "sp" 1-6
I can actually do the above, but my problems come when in some races, perhaps non runners means that maybe only 5 runners, then all of my code goes wrong. I ma not able to account for the numbers going out of sync.
part of my code below so you can see my approach.
BTW, dont have to use ie, but i dont know any other way.
Code:
Sub IE_getdogs()
Dim ie As InternetExplorer
Set ie = New InternetExplorer
With ie
.Visible = False
.Navigate "http://www.gbgb.org.uk/resultsMeeting.aspx?id=14000"
While .Busy Or .ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = .Document
End With
Set dogname = HTMLdoc.getElementsByClassName("essential greyhound")
Set trap = HTMLdoc.getElementsByClassName("trap")
Set sp = HTMLdoc.getElementsByClassName("sp")
For i = 1 To dogname.Length - 1
If dogname(i).innerText <> "Greyhound" Then
Range("'sheet1'!a" & i) = dogname(i).innerText
Range("'sheet1'!G" & i) = trap(i).innerText
Range("'sheet1'!M" & i) = sp(i).innerText
End If
Next
ie.Quit
End Sub
Thanks for looking, its doing my head in.
Dave[TABLE="width: 1654"]
<colgroup><col style="width:68pt" width="90"> <col style="width:32pt" width="42"> <col style="width:57pt" width="76"> <col style="width:30pt" width="40"> <col style="width:37pt" width="49"> <col style="width:39pt" width="52"> <col style="width:95pt" width="126"> <col style="width:98pt" width="131"> <col style="width:95pt" width="126"> <col style="width:93pt" width="124"> <col style="width:96pt" width="128"> <col style="width:89pt" width="118"> <col style="width:36pt" width="48" span="6"> <col style="width:33pt" width="44" span="6"> </colgroup><tbody>[TR]
[TD="width: 42"][/TD]
[TD="width: 76"][/TD]
[TD="width: 40"][/TD]
[TD="width: 49"][/TD]
[TD="width: 52"][/TD]
[TD="width: 126"][/TD]
[TD="width: 131"][/TD]
[TD="width: 126"][/TD]
[TD="width: 124"][/TD]
[TD="width: 128"][/TD]
[TD="width: 118"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 48"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[TD="width: 44"][/TD]
[/TR]
</tbody>[/TABLE]