以下是读取excle数据
Range("A2:L5000").ClearContents
Dim cnn As Object, rs As Object, SQL$
a = Range("e50000").End(xlUp).Row() + 1
Set cnn = CreateObject("ADODB.Connection")
cnn.Open "Provider = Microsoft.Ace.Oledb.12.0;Extended Properties =Excel 20.0;Data Source =\\njxr\财务共享\孩子王验收\2022年11月孩子王验收记录.xlsm"
SQL = "select '未验收'as 类型,日期,发货单号,客户编码,客户,备注,订单号,编码,货物,数量,单价,金额 FROM [发货单$] where 是否验收='未验收' and 金额>0"
Set rs = cnn.Execute(SQL)
Range("a2").CopyFromRecordset rs
SQL = "select IIF(验收金额=验收差异,'未退回','部分未退回')as 类型,验收日期,'T'&序号,编码,门店名称,'' as 备注,订单号,'' as 商品编码,'' as 货物,'' as 数量,'' as 单价,验收差异 FROM [验收对比$] where 验收差异<0 and 验收金额<0 "
Set rs = cnn.Execute(SQL)
各位大神,如何将rs的结果读取到数组中?请教
|