paspuggie48
New Member
- Joined
- Jun 21, 2011
- Messages
- 35
I'm lost as a bat and lack basic fundamental VBA knowledge but have drafted the code below and would like some advice please.
I have blocked the original line that contains 'rpb-greyhound-1' as this works perfectly, but when I try to increment the integer each time by 1 to 2, 3, 4, 5 or 6 it does not work for the other integers.
I need the line that contains 'rpb-greyhound-1' to start at 1 and increment by 1 until 'rpb-greyhound-6'.
What am I doing wrong? Have I put the for & next loops in the wrong place? Or can I not concatenate ' rpb-greyhound-" & StartRaceNumber & " hover-opacity" ?
I have blocked the original line that contains 'rpb-greyhound-1' as this works perfectly, but when I try to increment the integer each time by 1 to 2, 3, 4, 5 or 6 it does not work for the other integers.
I need the line that contains 'rpb-greyhound-1' to start at 1 and increment by 1 until 'rpb-greyhound-6'.
What am I doing wrong? Have I put the for & next loops in the wrong place? Or can I not concatenate ' rpb-greyhound-" & StartRaceNumber & " hover-opacity" ?
VBA Code:
Dim StartRaceNumber As Integer
Dim LastRaceNumber As Integer
XMLReq.Open "GET", DogPageURL, False
XMLReq.send
If XMLReq.Status <> 200 Then
MsgBox "Problem" & vbNewLine & XMLReq.Status & " - " & XMLReq.statusText
Exit Sub
End If
HTMLDoc.body.innerhtml = XMLReq.responseText
Set XMLReq = Nothing
LastRaceNumber = 6
For StartRaceNumber = 1 To LastRaceNumber
Set DogRows1 = HTMLDoc.getElementsByClassName("rpb-greyhound rpb-greyhound-" & StartRaceNumber & " hover-opacity")
' Set DogRows1 = HTMLDoc.getElementsByClassName("rpb-greyhound rpb-greyhound-1 hover-opacity")
For Each DogRow1 In DogRows1
Set DogNameLink1 = DogRow1.getElementsByTagName("a")(0)
NextHref = DogRow1.getAttribute("href")
NextURL = DogURL & Mid(NextHref, InStr(NextHref, ":") + 28)
Debug.Print DogRow1.innerText, NextURL
Next DogRow1
Next StartRaceNumber