VBA

Moderators: PavlinII
Number of threads: 1673
Number of posts: 3078

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Downloading Unicode Text from txt file into excel collumn Posted by ymnuhj on 25 Mar 2012 at 2:48 PM
'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 FileSystemObject
Dim FSOFile As TextStream
Dim FilePath As String
r = 1

FilePath = "C:\text.txt"

Set FSO = New FileSystemObject
If FSO.FileExists(FilePath) Then
Set FSOFile = FSO.OpenTextFile(FilePath, 1, False)
Buffer = vbNullString
Do While Not FSOFile.AtEndOfStream
Buffer = FSOFile.ReadLine()
ThisWorkbook.Worksheets(1).Cells(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
Attachment: text.zip (162 Bytes | downloaded 79 times)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.