Football - Live Scores

Please post any questions regarding the program here.

Moderator: 2020vision

Football - Live Scores

Postby mak » Thu Sep 27, 2012 1:34 pm

In order to test a few things in football markets i need to know the current score.
Ideally i would like a macro to do this automatically.
"Read" the current matches i have connected to excel and give the result in a cell
I am sure it can be done but don't know how.

If someone can provide such a code it would be very helpful

I have found something similar but i can't make it work
it gives me an error, and it is updating all scores

If anyone have an idea please tell me so

thanks
m

--------------------------------------------------------------------------------

Option Explicit

Private IE As Object
Dim t As Date

Sub StartTimer()
If t <> CDate(0) Then Exit Sub
Call xscores
End Sub

Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=t, Procedure:="xscores", Schedule:=False
t = CDate(0)
Call DisconnectFrom
On Error GoTo 0
End Sub


Private Function NavigateTo(strURL As String)
If IE Is Nothing Then Set IE = CreateObject("InternetExplorer.Application")

With IE
.Visible = False
.Navigate strURL
Do Until (.ReadyState = 4 And Not .Busy): DoEvents: Loop

End With
End Function
Private Function DisconnectFrom()
IE.Quit
Set IE = Nothing
End Function

Sub xscores()
Application.ScreenUpdating = False
Dim strURL As String
Dim ieDoc As Object
Dim AllTables As Object
Dim xTable As Object
Dim myWkSht As Worksheet
Dim TblRow As Object
Dim tblCell As Object

Dim r As Integer
Dim c As Integer
Columns("N:O").NumberFormat = "@"
strURL = "http://xscores.com/LiveScore.do?state=soccer&sport=1"

If t = CDate(0) Then
Call NavigateTo(strURL)
End If

Set ieDoc = IE.Document
Set AllTables = ieDoc.frames(3).Document.frames(1).Document.getElementsByTagName("TABLE")
Set xTable = AllTables.Item(0)
Set myWkSht = ThisWorkbook.Sheets("Sheet1")

r = 0
c = 0

For Each TblRow In xTable.Rows
r = r + 1
For Each tblCell In TblRow.Cells
c = c + 1
myWkSht.Cells(r, c) = tblCell.innerText
Next tblCell
c = 0
Next TblRow
r = 0

Dim rng As Range
For Each rng In Range(Sheets(1).Range("A1"), Sheets(1).Range("A65536").End(xlUp))

If rng.Text = "K/O" Then
rng.Offset(0, 3).Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
rng.Offset(0, 8).Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
rng.Offset(0, 16).Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
End If
Next rng
Columns("U:U").ClearContents
Range("A1").Select

'Call DisconnectFrom
't is set at 1 minute intervals
t = Now() + TimeValue("00:01:00")
Application.OnTime EarliestTime:=t, Procedure:="xscores", Schedule:=True
Application.ScreenUpdating = True
End Sub
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Re: Football - Live Scores

Postby Ferru123 » Sat Mar 23, 2019 8:58 pm

Hi

I would also find that useful,

Did you get an answer to your question?

Jeff
Ferru123
 
Posts: 89
Joined: Sat Feb 21, 2009 1:28 pm

Re: Football - Live Scores

Postby Equisitor » Thu May 02, 2019 1:27 pm

When i first started i also had this problem but I managed to do it out of sheer luck.

In excel go to DATA > GET Data > From Other Sources > From Web.

The URL you want is: http://old.xscores.com/soccer/livescores/
(the discovery of this URL is the sheet luck part).

When it boots up, you want Table 2, click OK and you have your table connected to excel. Change the refresh settings to once every minute and you are good to go. From experience, i moved away from this eventually as its heavy on excel having to do the lifting work and i found the match times (which i needed at the time) sometimes came through as 'NaN but other than that, I used this for a few months without problem.
Equisitor
 
Posts: 4
Joined: Sat Dec 01, 2018 11:39 am


Return to Help

Who is online

Users browsing this forum: No registered users and 49 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.