1.读入UTF-8文件
Dim value As String
Dim vLines As Variant
Call ReadCsvUTF_8(vFile.Path, value)
vLines = Split(value, vbCrLf)
For i = 0 To UBound(vLines)
…
next
Public Sub ReadCsvUTF_8(ByVal fileName As String, ByRef value As String)
With CreateObject("ADODB.Stream")
.Charset = "UTF-8"
.Open
.LoadFromFile fileName
value = .ReadText
.Close
End With
End Sub
2.写入UTF-8文件
Call WriteCsvUTF_8(fileSaveName, strLine)
Public Sub WriteCsvUTF_8(ByVal fileName As String, ByVal strLine As String)
With CreateObject("ADODB.Stream")
.Open
.Charset = "UTF-8"
.Type = adTypeText
.writeText strLine
.Position = 3
.SaveToFile fileName, adSaveCreateOverWrite
.Flush
.Close
End With
End Sub
手机扫一扫
移动阅读更方便
你可能感兴趣的文章