I'm using this code to import a line from a txt file into word:
Sub QuickType8()
Dim strFilename As String
Dim strTextLine As String
Dim iFile As Integer: iFile = FreeFile
Dim iLine As Integer
On Error GoTo lbl_Exit
strFilename = "C:\Users\Long\Dropbox\WIP word documents\5) Common Phrases.txt"
Open strFilename For Input As #iFile
iLine = 0
Do Until EOF(1)
iLine = iLine + 1
Line Input #1, strTextLine
If iLine = 8 Then
Exit Do
End If
Loop
Close #iFile
Selection.Text = strTextLine
lbl_Exit:
Exit Sub
End Sub
However, the text file is written in Vietnamese, so there're tons of unicode characters in it. When the data got inserted into Word, it's messed up badly (eg. "thời gian" became "ÿþthÝ i gian").
I tried saving the text file using Unicode encoding, but it doesn't work.
Is there any way I can get around this issue?
Scripting.FileSystemObject
orADODB.Stream
to read a file with that encodings. – omegastripes