PDA

View Full Version : Sleeper: Problem downloading data from Web



murfury
06-30-2005, 05:23 AM
I use ActiveWorkbook.FollowHyperlink (URL) in VBA macros where URL is a link of .xls file on the Web.

I want to open downloaded document in active Excel application and after use data from it in my macros, but I experienced some problems.

If I call this function from Excel the data is not downloaded, but when I call it from VBA Redactor using breakpoints in this special regime all work fine: data is downloaded and I can use it with my macros. I don?t understand how I can rewrite my program that it will work when I?ll call it directly from Excel. :(

Jacob Hilderbrand
07-20-2005, 10:19 PM
It may be that you are not allowing enough time for the file to download and the macro rushes on. With break points you are going slower.

Can you post the relevant code to your question and maybe we can help.

murfury
07-20-2005, 10:48 PM
Sub Open4Pages()
For i = 1 To 3
URL = "http://cbonds.info/quotes/index.php?report_type=xls&form=quotesForm&form_" & _
"submitted=quotesForm&region_id=0&country_id%5B%5D=1&sector_id=1&emitent_substring=&" & _
"emitent_id%5B%5D=0&paper_type_id=0&currency=0&ground_id%5B%5D=1&ground_id%5B%5D=2" & _
"&ground_id%5B%5D=3&ground_id%5B%5D=5&search_method=0&emission_id%5B%5D=0&begin_date=" & _
"05%2F02%2F2005&end_date=07%2F18%2F2005&rows_on_page=30&fields%5B%5D=0&fields%5B%5D=1&" & _
"fields%5B%5D=2&fields%5B%5D=3&fields%5B%5D=4&fields%5B%5D=5&fields%5B%5D=6&fields%" & _
"5B%5D=7&fields%5B%5D=8&fields%5B%5D=9&fields%5B%5D=10&fields%5B%5D=11&fields%5B%5D" & _
"=12&fields%5B%5D=13&fields%5B%5D=14&fields%5B%5D=15&fields%5B%5D=16&fields%5B%5D=17" & _
"&fields%5B%5D=18"
ActiveWorkbook.FollowHyperlink (URL), NewWindow:=True
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 60
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Next i
End Sub

I use Excel 2000
In download boxs I press "Open now" but after macros finished I have no additional Excel windows with downloaded data (((

murfury
07-20-2005, 10:55 PM
http://cbonds.info/quotes/index.php?report_type=xls&form=quotesForm&form_submitted=quotesForm&region_id=0&country_id%5B%5D=1&sector_id=1&emitent_substring=&emitent_id%5B%5D=0&paper_type_id=0&currency=0&ground_id%5B%5D=1&ground_id%5B%5D=2&ground_id%5B%5D=3&ground_id%5B%5D=5&search_method=0&emission_id%5B%5D=0&begin_date=05%2F02%2F2005&end_date=07%2F18%2F2005&rows_on_page=30&fields%5B%5D=0&fields%5B%5D=1&fields%5B%5D=2&fields%5B%5D=3&fields%5B%5D=4&fields%5B%5D=5&fields%5B%5D=6&fields%5B%5D=7&fields%5B%5D=8&fields%5B%5D=9&fields%5B%5D=10&fields%5B%5D=11&fields%5B%5D=12&fields%5B%5D=13&fields%5B%5D=14&fields%5B%5D=15&fields%5B%5D=16&fields%5B%5D=17&fields%5B%5D=18

Sorry the link in URL has been posted wrongly? this is a better one