看板 Office 關於我們 聯絡資訊
(若是和其他不同軟體互動之問題 請記得一併填寫) 軟體:Office 版本:2010 https://www.dropbox.com/s/hxsh00gkvz4xi2s/Log.txt?dl=0 以上為.txt檔格式 , 以下為程式碼不能讀到正確的格式 , 讀到excel檔sheet裡會產生以下網址的格式 https://www.dropbox.com/s/0xgngpcmhg6ldwc/2017-03-27_205115.jpg?dl=0 Application.ScreenUpdating = False Do If xChk = 0 Then xFile = Dir(ThisWorkbook.Path & "\*.txt") If xFile = "" Then MsgBox "※找不到 TXT 檔案! ", 0 + 16: Exit Sub xChk = 1 Else xFile = Dir If xFile = "" Then Exit Do End If '---------------------------------------------- uFile = ThisWorkbook.Path & "\" & xFile Set uHead = Range("A65536").End(xlUp) uHead.Value = xFile Set uHead = uHead(2, 1) With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & uFile, Destination:=uHead) .AdjustColumnWidth = False .TextFileParseType = xlDelimited .TextFileTabDelimiter = True .TextFileCommaDelimiter = True .TextFileConsecutiveDelimiter = True .Refresh End With Cells.Replace "", " " uHead.Interior.ColorIndex = 6 '每筆第一格加〔黃色〕底 NEXT_LINE: Loop 以下為讀取到錯誤的格式 https://www.dropbox.com/s/mwcmcugwwpnmd6p/LOG_Picture.jpg?dl=0 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.241.96.6 ※ 文章網址: https://www.ptt.cc/bbs/Office/M.1490619270.A.53D.html ※ 編輯: aup65797 (123.241.96.6), 03/27/2017 21:04:35
soyoso: 加上textfilespacedelimiter和textfileotherdelimiter 03/27 21:14
soyoso: 結果為https://i.imgur.com/RHkk3Mn 看是否為原po要的 03/27 21:15
aup65797: 都改為True嗎? 03/27 21:26
aup65797: OK了 , 感謝S大 03/27 21:33