-
Data import from web
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=de...ate=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)" ).
-
-
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:
[vba]
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
[/vba]
:)