"Chris" <CLarkou@gmail.comwrote in message
news:1194599649.145304.222170@57g2000hsv.googlegro ups.com...
Quote:
>I am using the FileSystemOBject for writing text with Unicode as in
the example below. When I try to read data from the file with
ReadLine, I get "?????????" instead of characters with unicode.
>
What could be the problem ?
>
Thanks a lot in advance!
>
------------------------------------------------------------------------------------------------
>
Dim var_file_sys As Object
Dim var_txt_file
Dim var_line As String
>
Set var_file_sys = CreateObject("Scripting.FileSystemObject")
Set var_txt_file = var_file_sys.CreateTextFile(vn_export_file, True,
True)
>
var_txt_file.writeline (var_line)
>
var_txt_file.Close
>
------------------------------------------------------------------------------------------------
>
Const ForReading = 1, TristateTrue = -1
Dim var_f As Object
Dim var_text As string
>
Set var_file_sys = CreateObject("Scripting.FileSystemObject")
Set var_f = var_file_sys.GetFile(vnp_import_file)
Set var_txt_file = var_f.OpenAsTextStream(ForReading,
TristateTrue)
>
var_text = var_txt_file.ReadLine
>
var_txt_file.Close
|
Not sure why it isn't working for you, but FWIW I msdr this test.vbs file,
and itworks perfectly. Maybe it'll give you a clue.
''' START CODE '''
Writefile
ReadFile
Sub Writefile
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("c:\temp\testfile.txt", -1, -1)
a.WriteLine("This is a test.")
a.Close
End Sub
Sub ReadFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\temp\testfile.txt", 1, 0, -1)
MsgBox f.ReadLine
f.Close
End Sub
''' END CODE '''