Comment exporter de Excel vers Access ?
Bonjour,
Est-ce quelqu'un peut me dire comment modifier le code suivant pour qu'il exporte plutôt qu'importe ?
(code trouvé ici http://www.developpez.net/forums/d74...ss-vers-excel/)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Sub Importe()
Dim cnt As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim MyRange As Range
Dim MaRequete As String
MyContrat = Cells(4, 4).Value
MyDates = Cells(6, 5).Value
Application.ScreenUpdating = False
Application.DisplayAlerts = False
URL_BASE = ActiveWorkbook.Path & "\données.mdb"
ChaineConnexion = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & URL_BASE & ";"
ChaineConnexion = ChaineConnexion & "Jet OLEDB:Database Password=" & dbPassword
cnt.Open ChaineConnexion
MySQL = "SELECT listing.Références, listing.Prix, listing.Dates " & _
"FROM listing " & _
"WHERE (((listing.Contrats) Like '" & MyContrat & "'));"
rst.Open MySQL, cnt, adOpenStatic
Cells(15, 1).CopyFromRecordset rst
End Sub |