我讀通過VBA行的文本文件一行到工作表(?)。它通常會返回這些字符。有誰知道如何去除它們?
這是怎麼了我讀它:
Sub ReadAsciiFile()
Dim sFileName As String
Dim iFileNum As Integer
Dim sBuf As String
Dim i As Integer
i = 1
' edit this:
sFileName = "usmap.txt"
' does the file exist? simpleminded test:
If Len(Dir$(sFileName)) = 0 Then
Exit Sub
End If
iFileNum = FreeFile()
Open sFileName For Input As iFileNum
Do While Not EOF(iFileNum)
Line Input #iFileNum, sBuf
' now you have the next line of the file in sBuf
' do something useful:
activesheet.Cells(i, 1) = sBuf
i = i + 1
Debug.Print sBuf
Loop
' close the file
Close iFileNum
End Sub
他們看起來像他們的不可打印表示(在當前字符集)字符。原文是什麼? – Robaticus 2010-08-27 19:07:20
原始文本是 – 2010-08-27 19:07:52