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