Can anyone spot why this function and the ones below cause BA and excel to go into 100% processor utilisation?
No doubt i'm being daft. The function is designed to get the market id and start time. I then use the ba event to drive the selection of the markets throughout the day on auto pilot.
- Code: Select all
Function Get_Race_ID(szCourseName, szRaceTime)
Dim arrEvnt()
ReDim Preserve arrEvnt(1)
Set ba = New BettingAssistantCom.ComClass
sports = ba.getSports()
For Each s In sports
If s.sport = "Horse Racing" Then
events = ba.getEvents(s.sportId)
For Each e In events
If e.eventname = "GB" Then
GBEvents = ba.getEvents(e.eventId)
For Each GBEvent In GBEvents
arrCourse = Split(GBEvent.eventname, " ")
If InStr(Name_Check(szCourseName), arrCourse(0)) Then
If InStr(GBEvent.eventname, Get_Date) Then
races = ba.getEvents(GBEvent.eventId)
For Each race In races
If InStr(race.startTime, szRaceTime) Then
If Not race.eventname = "To Be Placed" Then
arrEvnt(0) = race.eventId
arrEvnt(1) = race.startTime
Get_Race_ID = arrEvnt
Set ba = Nothing
Exit Function
End If
End If
Next
End If
End If
Next
End If
Next
End If
Next
End Function
Function Get_Date()
Get_Date = Replace(Format(Date, "dd"), "0", "")
End Function
Function Name_Check(szCourseName)
Select Case szCourseName
Case "Great Leighs"
Name_Check = "GLghs"
Exit Function
Case "Southwell"
Name_Check = "Sthl"
Exit Function
End Select
Name_Check = szCourseName
End Function
Cheers
Mark.