Error 76 in file download code

V

Vivek

Hi,

I'm trying to run the code below to download a csv file from a stock exchange site. Url:
http://www.nse-india.com/content/historical/EQUITIES/2008/FEB/cm19FEB2008bhav.csv

-------------------------------------------
Sub NSEDownloadCSVFile()

Dim bhavcsv As String
Dim path As String
Dim fs As Object

bhavcsv = "cm19FEB2008bhav" & ".csv"
path = "C:\"

Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile "//www.nse-india.com/content/historical/EQUITIES/2008/FEB/" & bhavcsv, path

End Sub
-------------------------------------------

I get an error :
Path not found (Error 76)

I put the above url in Firefox & IE and the csv comes along without any issues.
Any ideas what's happening here?
Any useful feedback will be appreciated.

Thanks,
Vivek
 
K

Kalpesh

Vivek,

FileSystemObject deals with files on your local machine/network & not
that are on the internet.
I suggest downloading file & then copying it

microsoft xml library has XMLHttpRequest class, which has a facility
to get the response content back from a given url
That should help

Kalpesh
 
V

Vivek

Kalpesh,

Thanks for the input. I have no idea whether FSO is designed for internet file downloads or not. Actually, I had posted in this very forum a few days back(Feb 12th) and had got the code to download a zip file from a stock exchange website. The code works very nicely and I don't need to manually download/process the file or leave Excel. That's why I thought of trying the same code on another stock exchange site but this time to download a csv file.

All,

Can anyone throw some light on this please?

Cheers,
Vivek
 
K

Kalpesh

Vivek,

There should not be any difference in terms of downloading a zip file
or a csv from the internet.
Let me know, what you need in specific.

I am sorry that I do not have MS Office installed on my machine.
However, I will try my best to help you out.

If you need, you can write to me at my gmail address: shah+kalpesh+77
(remove + signs)

Kalpesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top