- 帖子
- 26
- 主題
- 4
- 精華
- 0
- 積分
- 30
- 點名
- 0
- 作業系統
- Win10
- 軟體版本
- Office2019
- 閱讀權限
- 10
- 性別
- 男
- 註冊時間
- 2018-10-12
- 最後登錄
- 2022-7-25
|
[發問] 請教如何透過每天日期與儲存格文字來匯入外部資料呢
請問是否可以透過不同日期與儲存格的文字作為路徑,每天匯入不同的檔案呢- 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
複製代碼 |
-
-
匯入外部資料.rar
(17.23 KB)
|