34,838
社区成员




SELECT *
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source="c:\1.xls"
;Extended Properties=""Excel 8.0;"";Persist Security Info=True')...[1$A1:G10]
Dim strConnectionString As String
Dim strSql As String
On Error GoTo error_Handle
Set rs = New ADODB.Recordset
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""" & strFilePath & """;Extended Properties=""Excel 8.0;"";Persist Security Info=True"
strSql = "SELECT * FROM [" & strSheetName & "$" & strSheetRange & "]"
cn.Open strConnectionString
rs.CursorLocation = adUseClient
rs.Open strSql, cn, adOpenStatic, adLockBatchOptimistic