Consulting

Results 1 to 3 of 3

Thread: Data import from web

  1. #1
    VBAX Regular
    Joined
    Apr 2005
    Posts
    8
    Location

    Data import from web

    Hello!

    How 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)" ).
    Last edited by ferverx; 11-25-2005 at 12:45 AM. Reason: Edited post due to I found some answers to my questions!

  2. #2
    VBAX Regular
    Joined
    Apr 2005
    Posts
    8
    Location
    anyone?

  3. #3
    BoardCoder
    Licensed Coder
    VBAX Expert mark007's Avatar
    Joined
    May 2004
    Location
    Leeds, UK
    Posts
    622
    Location
    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]

    "Computers are useless. They can only give you answers." - Pablo Picasso
    Mark Rowlinson FIA | The Code Net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •