標題:
[發問]
請教如何透過每天日期與儲存格文字來匯入外部資料呢
[打印本頁]
作者:
dreamsway
時間:
2018-10-12 11:17
標題:
請教如何透過每天日期與儲存格文字來匯入外部資料呢
請問是否可以透過不同日期與儲存格的文字作為路徑,每天匯入不同的檔案呢
Sub 匯入外部資料()
Dim datecode As String '定義datacode為日期字串
Dim futures As String '定義futures為商品代號 其文字來源在Cells(2, "L")
y = Year(Now)
m = Month(Now)
d = Day(Now)
datecode = y & m & d
futures = Cells(2, "L") '試著把下方的日期與代碼改成定義的變數 卻無法作用
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;D:\data\datecode\futures\datecode_Match.txt", Destination:=Range("$A$2"))
.Name = "datecode_Match"
End Sub
複製代碼
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)