I am writing some code that opens up a number of files via a url. This all works fine, however after a while the server I am pulling this data from blocks me, which is throwing up an error message.
What I have tried to do is create an error handler that resets the error and then continues from the top after waiting 5 seconds. I have tried two things
On error resume next, to skip that line. This doesn't seem to do anything as the code still times out.
Go to error handler, wait 5 seconds, reset the error and then continue where the code already was.
Any ideas what I am doing wrong. example file paths below;
Sub TESTING()
Call START
Dim i As Integer
Workbooks("SHARE PRICE CREATOR.xlsb").Sheets("links").Activate
For i = 2 To Application.WorksheetFunction.CountA(Range("E:E"))
xtable = Cells(i, 5)
xURL = Cells(i, 4).Value
CONTINUE:
On Error GoTo Errhandle
Workbooks.Open xURL, FORMAT:=6, DELIMITER:=","
Workbooks("SHARE PRICE CREATOR.xlsb").Sheets("links").Activate
Cells(i, 6) = "OK"
Next
Errhandle:
On Error Resume Next
If Err.Number > 0 Then
Cells(i, 6) = Err.Number
End If
On Error GoTo 0
Application.Wait (Now + TimeValue("0:00:5"))
GoTo CONTINUE
Call ENDING
End Sub
Thanks
Scott