|
嗯。按LS的做吧,改成:- With objApp
- sql = "SELECT 交货日期,PO单号,客户订单号,产品型号,产品描述,总数量,箱数,每箱数量,预单号,备注,送货地区 FROM 表1"
- rs.Open sql, CurrentProject.Connection, 1, 3, 512
- If rs.RecordCount > 0 Then rs.MoveLast
- intN = 7 '出货资料模板.xlt第7行
- Do Until rs.BOF
- intN = intN + 1
- '不是第一行明细时插入一行
- If intN > 8 Then
- .Rows("8:8").Select
- objApp.Selection.Insert -4122, 1 'xlShiftDown=-4122,xlFormatFromRightOrBelow=1
- End If
- '写入订单明细
- .Range("A8") = rs!交货日期
- .Range("B8") = rs!PO单号
- .Range("C8") = rs!客户订单号
- .Range("D8") = rs!产品型号
- .Range("E8") = rs!产品描述
- .Range("F8") = rs!总数量
- .Range("G8") = Replace(rs!箱数, " ", Chr(10))
- .Range("H8") = Replace(rs!每箱数量, " ", Chr(10))
- .Range("I8") = rs!预单号
- .Range("J8") = rs!备注
- .Range("K8") = rs!送货地区
- .Range("K8").Select
- rs.MovePrevious
- Loop
- rs.Close
- Set rs = Nothing
- End With
复制代码 |
|