Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am posting this because I just searched the archives and found dozens of
unanswered questions about how to control the web query timeout. I finally got lucky with VBA Help -- which is very frustrating to use. It seems there are two parameters: ..RefreshPeriod and .ResetTimer The useful one is the 1st. There is also mention of QueryTimeout and Connection Timeout elsewhere in VBA help, but they give errors inside a web query. Here's my working code that seems to timeout after 10 seconds and continues on instead of freezing up when your website does not respond (hard to test since I can't force a website to not respond!). You'll have to invent your own method of deciding whether or not the query was successful. I test some cell I know should have data. If it doesn't, I assume it timed out and I try again or you can abort with an error message. With ActiveWorkbook.Worksheets("Temp").QueryTables.Add( _ Connection:="URL;" & strurl,Destination:=Worksheets("Temp").Cells(1, 1)) .TextFileParseType = xlDelimited .TextFileCommaDelimiter = True .SaveData = True .RefreshPeriod = 10 'Gives up after 10 seconds of no response .BackgroundQuery = False 'WAIT for results .Refresh End With I did see Query Events to give a True/False condition upon successful query, but they require some serious setup that is beyond me, especially since I'm using a temporary sheet created on the fly just to get the web data and then it gets deleted. Good Luck, Terry |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
TImeIn-TimeOut-TimeIn-TimeOut-HoursWorked | Excel Worksheet Functions | |||
Problem with .Background Query option of ODBC Query | Excel Programming | |||
Web Access Timeout | Excel Programming | |||
Timein-Timeout | Excel Programming | |||
Web query timeout | Excel Programming |