L
Lars R.
hallo,
i found the following macro on the web, that helps me get stock prices
from yahoo into a spreadsheet, but i have a problem with the
seperation of the cells.
Sub GetYQuotes()
Base01 = "http://de.finance.yahoo.com/d/quotes.csv?s=" '("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
the problem is, that if i run it with german yahoo finance site, the
information about the stock will be seperated wrongly ("DCX.DE;48"
"52;2/2/2007;17:35;+0" "28;48" "02;48" "64;47" "87;5770938") The
correct separation would be ("DCX.DE" "48,52" "2/2/2007" "17:35"
"+0,28" "48,02"; "48,64" "47,87" "5770938).
Seems to be a problem with vba (perhaps a problem between english and
german excel 2003 version with comma and semicolon). If i introduce
the web address in the browser, excel opens a file with correct
seperations. ("http://de.finance.yahoo.com/d/quotes.csv?s=DCX.DE
&f=sl1d1t1c1ohgv&e=.csv")
I tried to modify the workbooks.open method (format and delimiter) but
it didn't work.
Any idea?
Thank you very much
Lars
i found the following macro on the web, that helps me get stock prices
from yahoo into a spreadsheet, but i have a problem with the
seperation of the cells.
Sub GetYQuotes()
Base01 = "http://de.finance.yahoo.com/d/quotes.csv?s=" '("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
the problem is, that if i run it with german yahoo finance site, the
information about the stock will be seperated wrongly ("DCX.DE;48"
"52;2/2/2007;17:35;+0" "28;48" "02;48" "64;47" "87;5770938") The
correct separation would be ("DCX.DE" "48,52" "2/2/2007" "17:35"
"+0,28" "48,02"; "48,64" "47,87" "5770938).
Seems to be a problem with vba (perhaps a problem between english and
german excel 2003 version with comma and semicolon). If i introduce
the web address in the browser, excel opens a file with correct
seperations. ("http://de.finance.yahoo.com/d/quotes.csv?s=DCX.DE
&f=sl1d1t1c1ohgv&e=.csv")
I tried to modify the workbooks.open method (format and delimiter) but
it didn't work.
Any idea?
Thank you very much
Lars