[算表] 用VBA copy txt文件的問題
軟體:Excel
版本:2007
目前正使用某處找到的程式碼copy資料到excel,
但是有一個問題,若是txt裡面起始的位置出現
=(等於)
這個VBA就會失效,
請問該如何解決?謝謝。
Sub ReadTxt2()
Dim myTxtFile As String, myFNo As Integer
Dim myBuf As String
Dim i As Integer
Application.ScreenUpdating = False
myTxtFile = ActiveWorkbook.Path & "\M.txt"
Worksheets("文件類型").Activate
myFNo = FreeFile '取得可使用的檔案代碼
Open myTxtFile For Input As #myFNo
Do Until EOF(myFNo)
Line Input #myFNo, myBuf
i = i + 1
Cells(i, 1) = myBuf '將資料置入儲存格內
Loop
Close #myFNo
End Sub
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.251.225.44
推
03/12 23:14, , 1F
03/12 23:14, 1F
→
03/12 23:42, , 2F
03/12 23:42, 2F
Office 近期熱門文章
PTT數位生活區 即時熱門文章
-4
5