asdzxc
05-17-2012, 11:14 PM
Expected:list separator or )
original link : http://ichart.finance.yahoo.com/table.csv?s=^dji&a=08&b=13&c=2011&d=06&e=6&f=2013&g=w&ignore=.xlsx
In I2, to put d or w or m.
With Worksheets("Sheet1").QueryTables.Add(Connection:= _
"URL;http://ichart.finance.yahoo.com/table.csv?s=^dji&a=08&b=13&c=2011&d=06&e=6&f=2013&g=_
Worksheets("Sheet1").Range("I2").Value&ignore=.xlsx" _
, Destination:=Worksheets("Sheet1").Range("$A$1"))
On Error Resume Next
ThisWorkbook.Connections(1).Delete
Err.Clear:
On Error Goto 0
With Worksheets("Sheet1").QueryTables.Add(Connection:= _
"URL;http://ichart.finance.yahoo.com/table.csv?s=^dji&a=08&b=13&c=2011&d=06&e=6&f=2013&g=_
Worksheets("Sheet1").Range("I2").Value&ignore=.xlsx" _
, Destination:=Worksheets("Sheet1").Range("$A$1"))
.Name = _
"MyData" .FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = 0
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "4"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.Refresh BackgroundQuery:=False
original link : http://ichart.finance.yahoo.com/table.csv?s=^dji&a=08&b=13&c=2011&d=06&e=6&f=2013&g=w&ignore=.xlsx
In I2, to put d or w or m.
With Worksheets("Sheet1").QueryTables.Add(Connection:= _
"URL;http://ichart.finance.yahoo.com/table.csv?s=^dji&a=08&b=13&c=2011&d=06&e=6&f=2013&g=_
Worksheets("Sheet1").Range("I2").Value&ignore=.xlsx" _
, Destination:=Worksheets("Sheet1").Range("$A$1"))
On Error Resume Next
ThisWorkbook.Connections(1).Delete
Err.Clear:
On Error Goto 0
With Worksheets("Sheet1").QueryTables.Add(Connection:= _
"URL;http://ichart.finance.yahoo.com/table.csv?s=^dji&a=08&b=13&c=2011&d=06&e=6&f=2013&g=_
Worksheets("Sheet1").Range("I2").Value&ignore=.xlsx" _
, Destination:=Worksheets("Sheet1").Range("$A$1"))
.Name = _
"MyData" .FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = 0
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "4"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.Refresh BackgroundQuery:=False