On Error not catching problem with a web query  
Author Message
Brian in London





PostPosted: Visual Basic for Applications (VBA), On Error not catching problem with a web query Top

Why does "On Error" not seem to work in this case Once every few hundred iterations, there will be a failure, timeout, or resource not available error on the last line which invokes .Refresh BackgroundQuery:=False.

Any insights would be much appreciated.

Regards,

Brian

code excerpt...........................

On Error GoTo query3error

With ActiveSheet.QueryTables.Add(Connection:= _
"URL; http://www.hide-link.com/ ; & ticker, Destination:=Range("A1"))
.Name = "q s=" & ticker
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False ' was True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.webtables = webtables(trials - 1) ' was "16"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = True ' was False
.Refresh BackgroundQuery:=False
End With



Microsoft ISV Community Center Forums1  
 
 
DMan1





PostPosted: Visual Basic for Applications (VBA), On Error not catching problem with a web query Top

Brian please use the VBA forum to post questions regarding Visual Basic For Applications...

Moving thread to VBA



 
 
Derek Smyth





PostPosted: Visual Basic for Applications (VBA), On Error not catching problem with a web query Top

hi,

I hope this doesn't seem daft but have you defined the query3error label