PDA

View Full Version : Data import from web



ferverx
11-24-2005, 08:29 AM
Hello!

How :think: to make the Import external data (from web) to download and save files by adress: http://market.rfb.lv/index.php?pg=details&instrument=LV0000100626&list=4&popup=trades&downloadcsv=1&date=2005-11-22, so that excel tries to use as "date=2005-11-22" all dates from 01.11.2005 till today and saves those txt files on disk giving those files names in date format (example "yyyymmdd")?
I have added the example of iqy file - basically I want a macro that will
1)change the "date=2005-11-22" in this file (till today).
2)if there is data - downloads data into Excel (putting in first column the date); if there is no data - tries other dates;
3)saves file by name "yyyymmdd.txt";
4)tries other dates (go to step "1)" ).

ferverx
11-25-2005, 07:38 AM
anyone?: pray2:

mark007
11-27-2005, 07:05 PM
If it's a file excel recignises then workbooks.open will do it. The you just need a simple loop and some error handling.

Something like:


dim i as long
dim d as date
dim wb as workbook
d=dateserial(2005,11,1)
on error goto next_wb
for i=0 to Clng(Date-d)
set wb=workbooks.open("http://market.rfb.lv/index.php?pg=d...date=" & format(d+i,"yyyy-mm-dd"))
wb.saveas "C:\" & format(d+i,"yyyymmdd") & ".txt"
wb.close false
next_wb:
next i


:)