終於找到了補救由通過數據導出=>從文本選項上面的問題可以得到解決..
下面是相同的代碼..
Do While fname <> ""
Workbooks.Add
Set wBook = ActiveWorkbook
Set wksht = ActiveSheet
With wksht.QueryTables.Add(Connection:="TEXT;" & folder_name & fname, Destination:=Range("$A$1"))
.Name = fname
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 65001
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierNone
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
VBA並不意味着用作其他程序的自動化。爲什麼不使用大容量文件重命名器(例如[Ant Renamer](http://portableapps.com/apps/utilities/ant_renamer_portable))將tsv文件重命名爲txt文件? –
另存爲csv文件'FileFormat:= xlCSV' – 0m3r
@Peh如果我直接重命名它有一些影響數據的bug形成。因此,我們必須在Notepadd ++中打開。 – Linga