|

楼主 |
发表于 2016-10-19 16:40
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 betar 于 2016-10-19 16:41 编辑
版主提供的那个链接里面有个work around, 还没尝试过,似乎应该也不可以使用?
- 'Open the Excel workbook to prompt for the password
- Dim xl As Object
- Set xl = GetObject(CurrentProject.Path & "" & "MASTER JAN 2009.xls")
- 'Now open the workbook to read/write/whatever
- Dim cnn1 As New ADODB.Connection
- Dim rst1 As ADODB.Recordset
- Dim strExcelName As String = "MASTER JAN 2009.xls"
- Dim strWkBkName As String = "[MASTER 2008$]"
- cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
- "Data Source=" & CurrentProject.Path & "" & strExcelName & ";" _
- "Extended Properties=""Excel 8.0;"";"
- Set rst1 = New ADODB.Recordset
- rst1.Open strWkBkName, cnn1, , , adCmdTable
- Do Until rst1.EOF
- 'process your data here
- rst1.MoveNext
- Loop
复制代码 |
|