Can anyone help please?
Can anyone help please?
Hi
I could get it to work by enclosing the field names in square brackets:
Richard![]()
Sub aaa() Range("B:C").ClearContents Set cn = CreateObject("adodb.connection") Set rs = CreateObject("adodb.recordset") cn.Open "provider=microsoft.jet.oledb.4.0;data source = C:\Documents and Settings\Lenovo_User\My Documents\My Data Sources\upcdirectory;extended properties = ""text; hdr=yes""" For Each ce In Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row) rs.Open "select [size],[description] from items.csv where [UPC] = " & ce.Value, cn, 3, 3 Cells(ce.Row, 2).CopyFromRecordset rs rs.Close Next ce Set rs = Nothing Set cn = Nothing End Sub
Richard Schollar
Microsoft MVP - Excel
Works great! Richard you are wonderful.Thank you so much.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks