Hi all,
I've used several tips to read a csv-file. However I can't seem to get it to work.
I use the next code:
====================================
Dim fs, objTextfile
Set fs = CreateObject("Scripting.FileSystemObject")
dim arrStr
set objTextfile = fs.OpenTextFile("\\ict01\RevalidantmapAansturing\Databases\test.csv",1)
Do while NOT objTextFile.AtEndOfStream
arrStr = split(objTextFile.ReadLine,";")
strWaarde1 = arrStr(0)
strWaarde2 = arrStr(1)
Wscript.echo strWaarde1 & " " & strWaarde2
Loop
objTextFile.Close
set objTextFile = Nothing
set fs = nothing
============================================
The first echo gives a strange string of three characters. All next echo's are empty.
At last I get an error that the subscript is out of range for the array(1).
So, what am I doing wrong here? Can the csv (produced bij Cognos8 report) be corrupted? Whenever I use a text-file (txt) the script works fine.
Any help is appriciated.
Rinze Smit
Revalidatie Friesland
I've used several tips to read a csv-file. However I can't seem to get it to work.
I use the next code:
====================================
Dim fs, objTextfile
Set fs = CreateObject("Scripting.FileSystemObject")
dim arrStr
set objTextfile = fs.OpenTextFile("\\ict01\RevalidantmapAansturing\Databases\test.csv",1)
Do while NOT objTextFile.AtEndOfStream
arrStr = split(objTextFile.ReadLine,";")
strWaarde1 = arrStr(0)
strWaarde2 = arrStr(1)
Wscript.echo strWaarde1 & " " & strWaarde2
Loop
objTextFile.Close
set objTextFile = Nothing
set fs = nothing
============================================
The first echo gives a strange string of three characters. All next echo's are empty.
At last I get an error that the subscript is out of range for the array(1).
So, what am I doing wrong here? Can the csv (produced bij Cognos8 report) be corrupted? Whenever I use a text-file (txt) the script works fine.
Any help is appriciated.
Rinze Smit
Revalidatie Friesland