ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code for file download (https://www.excelbanter.com/excel-programming/405987-code-file-download.html)

Vivek[_2_]

Code for file download
 
Hi,

Need some help automating a daily task of mine - downloading a zip file from a stock exchange site and saving it to disk.

Here are the steps involved:

Browse to http://www.bseindia.com/mktlive/bhavcopy.asp
Click on the link : "Download file in csv format (Zipped)" Alternatively, the file can be directly downloaded in which case the url would be http://www.bseindia.com/bhavcopy/eq<ddmmyy_csv.zip Of course ddmmyy would be replaced by date chosen by me.
Save zip to folder C:\abcd

Would be grateful for suggestions.

Cheers...
Vivek

joel

Code for file download
 
Sub test()

MyDate = Format(Date, "DDMMYY")
ZipFile = "eq" & MyDate & "_csv.zip"

Set fs = CreateObject("Scripting.FileSystemObject") '
fs.CopyFile "//www.bseindia.com/bhavcopy/" & ZipFile, "c:\abcd\"

End Sub

"Vivek" wrote:

Hi,

Need some help automating a daily task of mine - downloading a zip file from a stock exchange site and saving it to disk.

Here are the steps involved:

Browse to http://www.bseindia.com/mktlive/bhavcopy.asp
Click on the link : "Download file in csv format (Zipped)" Alternatively, the file can be directly downloaded in which case the url would be http://www.bseindia.com/bhavcopy/eq<ddmmyy_csv.zip Of course ddmmyy would be replaced by date chosen by me.
Save zip to folder C:\abcd

Would be grateful for suggestions.

Cheers...
Vivek


Vivek[_2_]

Code for file download
 
Hi Joel,

Thanks for the code, works well for me :)

Vivek

"Joel" wrote in message ...
Sub test()

MyDate = Format(Date, "DDMMYY")
ZipFile = "eq" & MyDate & "_csv.zip"

Set fs = CreateObject("Scripting.FileSystemObject") '
fs.CopyFile "//www.bseindia.com/bhavcopy/" & ZipFile, "c:\abcd\"

End Sub

"Vivek" wrote:

Hi,

Need some help automating a daily task of mine - downloading a zip file from a stock exchange site and saving it to disk.

Here are the steps involved:

Browse to http://www.bseindia.com/mktlive/bhavcopy.asp
Click on the link : "Download file in csv format (Zipped)" Alternatively, the file can be directly downloaded in which case the url would be http://www.bseindia.com/bhavcopy/eq<ddmmyy_csv.zip Of course ddmmyy would be replaced by date chosen by me.
Save zip to folder C:\abcd

Would be grateful for suggestions.

Cheers...
Vivek



All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com