標題:
vba 網址問題
[打印本頁]
作者:
ken759727
時間:
2013-7-26 11:27
標題:
vba 網址問題
本帖最後由 ken759727 於 2013-7-26 11:28 編輯
Range("A11").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;[color=Red]http://ichart.finance.yahoo.com/table.txt?s=2002.TW&d=6&e=26&f=2013&g=d&a=0&b=4&c=2000&ignore=.txt[/color]" _
, Destination:=Range("$A$11"))
.Name = "table.txt?s=2002.TW&d=6&e=26&f=2013&g=d&a=0&b=4&c=2000&ignore="
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 950
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
ActiveWindow.SmallScroll Down:=-12
複製代碼
以上是錄製巨集(從文字檔插入資料)
主要是想修改紅色文字部分,想把參數值加進入,不知該如何表達會比較恰當
http://ichart.finance.yahoo.com/table.txt?s=
2002
.TW&d=
6
&e=
26
&f=
2013
&g=
d
&a=
0
&b=
4
&c=
2000
&ignore=.txt
這邊2002 想改成變數
假如變數是 I
請問要如何撰寫會比較恰當
懇請高手幫忙
作者:
GBKEE
時間:
2013-7-26 12:13
回復
1#
ken759727
& 運算子連結
"TEXT;http://ichart.finance.yahoo.com/table.txt?s=" & I & ".TW&d=6&e=26&f=2013&g=d&a=0&b=4&c=2000&ignore=.txt"
複製代碼
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)