I'm trying to read Unicode from file correctly using VBA. However I managed read correctly only first string. Code:
Sub ReadTextFile()
Dim Buffer
Dim FSO As FileSystemObjec t
Dim FSOFile As TextStream
Dim FilePath As String
r = 1
FilePath = "C:\text.tx t"
Set FSO = New FileSystemObjec t
If FSO.FileExists( FilePath) Then
Set FSOFile = FSO.OpenTextFil e(FilePath, 1, False)
Buffer = vbNullString
Do While Not FSOFile.AtEndOf Stream
Buffer = FSOFile.ReadLin e()
ThisWorkbook.Wo rksheets(1).Cel ls(r, 1).Value = StrConv(Buffer, vbFromUnicode)
r = r + 1
Loop
FSOFile.Close
Else
MsgBox (FilePath & " does not exist")
End If
End Sub
I know it shouldn't be difficult but I'm trying second day without any progress. Does smb have any suggestions or solution?
Thanks
Sub ReadTextFile()
Dim Buffer
Dim FSO As FileSystemObjec t
Dim FSOFile As TextStream
Dim FilePath As String
r = 1
FilePath = "C:\text.tx t"
Set FSO = New FileSystemObjec t
If FSO.FileExists( FilePath) Then
Set FSOFile = FSO.OpenTextFil e(FilePath, 1, False)
Buffer = vbNullString
Do While Not FSOFile.AtEndOf Stream
Buffer = FSOFile.ReadLin e()
ThisWorkbook.Wo rksheets(1).Cel ls(r, 1).Value = StrConv(Buffer, vbFromUnicode)
r = r + 1
Loop
FSOFile.Close
Else
MsgBox (FilePath & " does not exist")
End If
End Sub
I know it shouldn't be difficult but I'm trying second day without any progress. Does smb have any suggestions or solution?
Thanks
Comment