看板 Office 關於我們 聯絡資訊
Sub test() Dim qt As QueryTable Set qt = ActiveSheet.QueryTables.Add("TEXT;d:\20160703.txt", [a1]) With qt .AdjustColumnWidth = False .TextFileParseType = xlDelimited .TextFileTabDelimiter = True .TextFileCommaDelimiter = True .Refresh End With End Sub 用以上方式 , excel讀取會空一格 , 麻煩大大 https://www.dropbox.com/s/4uxgfuykhl0h6ix/VBA%20TAB%20format.PNG?dl=0 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.241.96.6 ※ 文章網址: https://www.ptt.cc/bbs/Office/M.1468069184.A.DB2.html
soyoso: 加上textfileconsecutivedelimiter=true 試試 07/09 21:18
azteckcc: 把你的 TXT 傳上來,個人猜你的txt裡 07/09 21:18
azteckcc: 可能會有狀況,比如同時有分隔符同時有tab和逗號 07/09 21:20
aup65797: 還是一樣不行ㄟ 07/09 21:28
aup65797: 就是同時有逗號和Tab 07/09 21:31
aup65797: 成功了..感謝S大 07/09 21:38
soyoso: 測試上將連結內TextFileTabDelimiter改為true再加上回文第 07/09 21:41
soyoso: 一筆的部分,應可https://imgur.com/LGBAe2D 07/09 21:42