|
- Sub A()
- Cells.ClearContents
- Dim arr, arr1, crr
- Dim CON As New ADODB.Connection
- Dim RE As New ADODB.Recordset
- Dim K As Integer
- Dim i As Integer
- Dim SQ As String
- SQ = "SELECT 单位,iif(isnull(出库数量),'',出库数量) FROM [jiazhuang$] WHERE 单位='套' "
- With CON
- .CommandTimeout = 10
- .ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;;extended properties=excel 12.0;data source=" & ThisWorkbook.Path & "\加装销售明细.xlsx"
- .Open
- RE.Open SQ, CON, adOpenKeyset, adLockOptimistic
- arr = Application.Transpose(RE.GetRows()) '错误的地方。给数组赋值的时候出现类型不匹配
- End With
- RE.Close
- CON.Close
- Set RE = Nothing
- Set CON = Nothing
- End Sub
复制代码 |
|