1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Sub test()
Set Cn = New ADODB.Connection
' pour Xl 2007
Cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Fichier & ";" & _
"Extended Properties=""Excel 12.0;HDR=NO;"""
'Cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Fichier & ";" & _
"Extended Properties=""Excel 8.0;HDR=No;"";"
'------------------
strSQL = "SELECT * FROM [" & NomFeuille & "$]"
Set Rst = New ADODB.Recordset
Rst.Open strSQL, , adOpenKeyset, adLockOptimistic
MsgBox Rst.RecordCount + 1
Set Rst = Nothing
Set Cn = Nothing
End Sub |