Hello!
I need to import some data from a .csv file, process it and write results in an Excel file.
So... I use ADODB recordsets and Microsoft Text Driver:
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
Dim cnStr As String
cnStr = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" _
& filePath & ";Extensions=csv,txt;"
cn.Open cnStr
Set rs = New ADODB.Recordset
rs.Open "select * from " & fileName & " " _
& "", cn, adOpenStatic, adLockOptimistic, 1
All works ok BUT the csv file <fileName> contains some HEX data(.csv file is generated from a EPROM dump file) which the query replaces with ""
This is csv file:
id043_AAdParIsa1 40 7E 7F 7E BE FC 1 0 40 7E 7F 7E BE FC 1 0
id043_AAdParIsa1 40 7E 7F 7E BE FC 1 0 40 7E 7F 7E BE FC 1 0
id043_AAdParIsa1 40 7E 7F 7E BE FC 0 0 0 FF 0 0 0 FF 0 0
id043_AAdParIsa1 0 FF 0 0 0 FF 0 0 0 FF 0 0 0 FF 0 0
id043_AAdParIsa1 0 0 0 0 0 0 0 0 2 40 40 3 0 0 0 0
id043_AAdParIsa1 0 0 0 14 E0 18 30 2 0 0 0 0 2 0 40 1
And this is my recordset:
id043_AAdParIsa1 40 1 0 40 1 0
id043_AAdParIsa1 40 1 0 40 1 0
id043_AAdParIsa1 40 0 0 0 0 0 0 0 0
id043_AAdParIsa1 0 0 0 0 0 0 0 0 0 0 0 0
id043_AAdParIsa1 0 0 0 0 0 0 0 0 2 40 40 3 0 0 0 0
id043_AAdParIsa1 0 0 0 14 18 30 2 0 0 0 0 2 0 40 1
I don't know why... but if there is 1 or 2 characters... i just get the "". Anyone knows why is this happening? I tried querying in another sheet of the same workbook with the code.... any FF, 1C, 4E or even u ( lcase("U")) is read as "". BUT NOT THE "x" !!!!
I have to import data from 2 files, process it, compare results and then export a table. I don't want to iterate trough 4096 lines, cell by cell, to find what I need.
Any help would be appreciated! Thanks in advance!
Seba Sama