View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
martopeteiro martopeteiro is offline
external usenet poster
 
Posts: 1
Default Setting timeout for Web queries

Hello,
I'm trying to get data from a web page through a web query in a macro.
The problem is that, sometimes, this web page takes way too long to
load, or may never appear (the server is not good). In Internet
Explorer, if I go that page and notice it's taking too long, I just hit
Refresh and the page usually appears in less than 2 seconds. If I don't
hit Refresh, the page might never appear.

Now I'm trying to do the same thing in a macro. I want Excel to run the
following query, but if after 5 seconds the data is not there, I want
it to stop and try again. I've tried using .QueryTimeout, but it
doesn't seem to accept that command (although it's in the help file)

cn = "url; http://something.com"
Set table_1 = Page_1.QueryTables.Add(Connection:=cn,
Destination:=Page_1.Cells(1, 1))

With table_1
..BackgroundQuery = True
..Refresh
End With

Thanks a lot in advance,
Martín


---
Message posted from http://www.ExcelForum.com/