Anyone reckonise how to overide this vba crash

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

Anyone reckonise how to overide this vba crash

Postby Fixador » Mon Apr 13, 2009 9:51 pm

This is code for scraping an Oddschecker webpage - works fine most of the time - haven't got a clue how it works - i just recorded a macro.

However - it now and then - seems it cant find the page - so , i inserted an "On error resume " just above the "End With" - dont work though - i get the line above "Refresh BackgroundQuery:=False" highlighted in yellow

Code: Select all
Set WK4 = Workbooks(myfilename20)
'----------------build url---------------------------
myUrl = "URL;http://www.oddschecker.com/horse-racing/" & WK4.Worksheets(1).Cells(1, 1) & "/" & Format(WK4.Worksheets(1).Cells(2, 1), "HH:mm")
'----------now call up scalping code - direct capture to sheet 2 ----------------
With WK4.Worksheets(1).QueryTables.Add(Connection:= _
        "URL;http://www.oddschecker.com/horse-racing/" & WK4.Worksheets(1).Cells(1, 1) & "/" & Format(WK4.Worksheets(1).Cells(2, 1), "HH:mm"), Destination:= _
        Range("A3"))
        '.Name = "50" ' was 20 error here should be number of minutes
        .Name = mysymbol & RaceMins & mysymbol
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "2" ' was 4
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = True
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
        On Error Resume Next
    End With
'>>>>>>>>> an error trap : for some reason it has captured the imdex page
If WK4.Worksheets(1).Cells(8, 1) = "Today's Racing:" Then
    'error has occurred : if exit then no data is passed - return to main procedure
    'would like to try it again - nar
    WK4.Worksheets(1).Range("A6:AA5000").ClearContents
    Exit Sub
Else:
    'proceed as normal


Now i can live with not getting the webpage now and then - but vba stopping - is screaming abdabs time !

Please someone help
Fixador
 
Posts: 322
Joined: Mon Apr 23, 2007 9:24 am

Postby Ian » Wed Apr 15, 2009 12:00 pm

Try moving "On Error Resume Next" before the With Statement.
Ian
 
Posts: 834
Joined: Sat Nov 19, 2005 8:35 am
Location: Birmingham

Postby Fixador » Sat Apr 18, 2009 9:51 pm

Thanks Ian - have adjusted code - will be trying it tomorrow
Fixador
 
Posts: 322
Joined: Mon Apr 23, 2007 9:24 am

Postby Fixador » Sun May 03, 2009 8:30 am

no more crashes Ian - many thanks
Fixador
 
Posts: 322
Joined: Mon Apr 23, 2007 9:24 am


Return to Discussion

Who is online

Users browsing this forum: Bing [Bot] and 34 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.