Add ReadCSVFileWithUtf8 and use it in Z1
This commit is contained in:
@@ -129,3 +129,25 @@ Sub WriteCSVFile(ByVal filePath As String, ByVal content As String)
|
||||
.Close
|
||||
End With
|
||||
End Sub
|
||||
|
||||
Function ReadCSVFileWithUtf8(ByVal filePath As String) As Variant
|
||||
If filePath = "" Then
|
||||
ReadCSVFileWithUtf8 = Array()
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Dim stream As Object
|
||||
Dim textContent As String
|
||||
|
||||
Set stream = CreateObject("ADODB.Stream")
|
||||
With stream
|
||||
.Type = 2
|
||||
.Charset = "utf-8"
|
||||
.Open
|
||||
.LoadFromFile filePath
|
||||
textContent = .ReadText
|
||||
.Close
|
||||
End With
|
||||
|
||||
ReadCSVFileWithUtf8 = Split(textContent, vbLf)
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user