|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties='Excel 12.0;HDR=yes';data source=" & ThisWorkbook.FullName
Cn.Open "Provider=Microsoft.JET.OLEDB.4.0;Extended Properties='Excel 8.0;HDR=yes';Data Source=" & ThisWorkbook.FullName
- Function SqlRetuRs1(Str)
- Dim Cn As ADODB.Connection
- Set Cn = New ADODB.Connection
- Dim Rs As ADODB.Recordset
- Set Rs = New ADODB.Recordset
- 'Cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties='Excel 12.0;HDR=yes';data source=" & ThisWorkbook.FullName
- Cn.Open "Provider=Microsoft.JET.OLEDB.4.0;Extended Properties='Excel 8.0;HDR=yes';Data Source=" & ThisWorkbook.FullName
- Rs.Open Str, Cn, adOpenKeyset, adLockOptimistic
-
- Set SqlRetuRs1 = Rs
- End Function
- Sub DELDELDEL()
- Dim Str, Rs As ADODB.Recordset
- Str = "Select format(oDate,'yyyy/mm/dd'),BB From [Sheet2$] Where BB is not Null"
- Str = "Select oDate,Name,Size From [Sheet5$D1:F300]"
- Str = "Select oDate,Name,oSize From [Sheet5$D1:F30]"
- Debug.Print Str
- Set Rs = SqlRetuRs1(Str)
- Debug.Print Rs.RecordCount, Rs.Fields.Count
- Rs.MoveFirst
- For ii = 0 To Rs.RecordCount - 1
- For jj = 0 To Rs.Fields.Count - 1
- Debug.Print Rs.Fields(jj),
- Next jj
- Debug.Print
- Rs.MoveNext
- Next ii
- End Sub
复制代码
Select oDate,Name,oSize From [Sheet5$D1:F30]
29 3
2020/9/27 15:15:08 IMG_20200927_151508.jpg .2
2020/9/29 17:36:28 IMG_20200929_173628.jpg .2
2020/9/29 21:06:51 IMG_20200929_210651.jpg .3
2020/9/29 21:06:57 IMG_20200929_210657.jpg .1
2020/9/29 21:07:04 IMG_20200929_210704.jpg .1
2020/9/29 21:07:09 IMG_20200929_210709.jpg .2
|
|