Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default macro to download a csv file

I want to download a csv file(one sheet file) into my excel w/book as a one
of my w/sheet.Is there any macro that do the task.This is a dialy activity I
am doing.Launching IE,browsing the website for related links,finding the
downloaded file,downloading,saving in my documents,extrating from zip
folder,moving the page to w/book,renaming the w/sheet(before renaming
deleting the yesterday's sheet).
The macro should work on w/book open event with time criteria(say everyday
10PM)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default macro to download a csv file

Hi,

As an example, here is the download of csv related to Yahoo stock
quotes ...

Sub GetYQuotes()
Base01 = "http://finance.yahoo.com/d/quotes.csv?s="
Base02 = "&f=sl1d1t1c1ohgv&e=.csv"
sURL = ""
SymString = ""

LastRow = Cells(65536, 1).End(xlUp).Row

For i = 1 To LastRow
SymString = SymString & Cells(i, 1) & " "
Next i
sURL = Base01 & SymString & Base02
Workbooks.Open sURL
Set rngSource = Cells(1).CurrentRegion
x = rngSource.Rows.Count
y = rngSource.Columns.Count
With ThisWorkbook.Sheets(1)
Set rngDest = Range(.Cells(1, 1), .Cells(x, y))
End With
rngDest.Value = rngSource.Value
ActiveWorkbook.Close SaveChanges:=False
End Sub

HTH
Carim

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to download a file. tkraju via OfficeKB.com Excel Discussion (Misc queries) 1 August 26th 06 01:53 PM
Download ZIP file from ftp using macro? John Elink Excel Programming 0 March 4th 05 02:52 PM
Download of the file from macro John Elink Excel Programming 1 January 17th 05 02:53 PM
Macro did not run after download file from net ariffin Excel Worksheet Functions 0 November 6th 04 10:54 AM
Macro did not run after download file from net ariffin Excel Worksheet Functions 2 November 6th 04 01:20 AM


All times are GMT +1. The time now is 10:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"