Hi everyone,
I have attached 2 sample files. I'm trying to get a kind of Vlookup from data that is in a more than 50 MB CSV file (comma delimeted).
I want to lookup values in column A of "LookUpResults.xlsx" that match values in column A of "Origin.csv". For each matching row, put in
column B values from column B, in C values from C, in D values from D.
I've been trying some ADO codes in order to test but doesn't show any value.
Some of the codes I've been testing without success is:
(source: http://technet.microsoft.com/en-us/l.../ee692882.aspx)
Sub LookUp_With_ADO()
On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H1
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Scripts\Test.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes;"";"
objRecordset.Open "Select * FROM [Sheet1$] Where Number = 2", _
objConnection, adOpenStatic, adLockOptimistic, adCmdText
Do Until objRecordset.EOF
Wscript.Echo objRecordset.Fields.Item("Name"), _
objRecordset.Fields.Item("Number")
objRecordset.MoveNext
Loop
End Sub
May somebody help me to get this working?
* The Origin.csv files doesn't have headers.
Many thanks in advance.
Regards
Bookmarks