- 帖子
- 3
- 主題
- 2
- 精華
- 0
- 積分
- 5
- 點名
- 0
- 作業系統
- windows
- 軟體版本
- 2007
- 閱讀權限
- 10
- 註冊時間
- 2012-7-13
- 最後登錄
- 2012-7-16
|
多個不同檔名的檔案執行
我又有新的問題
如果我資料夾中有.000、.001、.002...~.027
每個檔案檔名都一樣
不過我想要寫好的語法之後不管放什麼檔名進去都可以執行
是不是可以用*代表檔名整個字串
If i < 10 Then
For i = 0 To 9
If i > 2 Then Sheets.Add After:=Sheets(Sheets.Count)
Sheets("Sheet" & i + 1 & "").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;D:\0607-H7P-N\內化數據.00" & i & "", Destination:=Range("$A$1"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Next
End If |
|