Hello All,
I am using the following web query to retrieve data from a site. I have an error bypass in the code. If I turn off the error bypass then the query will fail and the .Refresh line is the culprit. However, if I remove .Refresh from the code, the request fails and I get no data back. It is not mission critical, because I can change the error handling to 'Resume Next' and then put in a GoTo if there is another error, but I would like to know what is going on. Any suggestions?
Thank you,
Dave
I am using the following web query to retrieve data from a site. I have an error bypass in the code. If I turn off the error bypass then the query will fail and the .Refresh line is the culprit. However, if I remove .Refresh from the code, the request fails and I get no data back. It is not mission critical, because I can change the error handling to 'Resume Next' and then put in a GoTo if there is another error, but I would like to know what is going on. Any suggestions?
Code:
Public Sub W_Query()
url = "http://www.stockwatch.com/utilit/utilit_webquery.aspx?what=quote&header=N&fields=SBAEOHILV&symbols=" & symbolQ
Dim q As QueryTable
Set q = tmpSheet.QueryTables.Add( _
Connection:="URL;" & url, _
Destination:=tmpSheet.Range("A2"))
With q
.WebConsecutiveDelimitersAsOne = False
.WebDisableDateRecognition = False
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebSelectionType = xlEntirePage
.WebSingleBlockTextImport = False
.RefreshStyle = xlOverwriteCells
.BackgroundQuery = False
.Refresh
End With
End Sub
Thank you,
Dave