[VBA-E]Creer une bd access
coucou,
apres un recherche j'ai trouvé comment remplir une table Access
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Sub OuvrirAccess()
'necessite d'activer la reference
'Microsoft ActiveX Data Objects 2.0 Library
Dim Conn As New ADODB.Connection
Dim rsT As New ADODB.Recordset
With Conn
.Provider = "Microsoft.JET.OLEDB.4.0"
.Open ThisWorkbook.Path & "\bd1.mdb"
End With
With rsT
.ActiveConnection = Conn
.Open "Table1", LockType:=adLockOptimistic
End With
With rsT
.AddNew
.Fields("clé").Value = Sheets(1).Cells(1, 1).Value
.Update
End With
rsT.Close
Set rsT = Nothing
Conn.Close
Set Conn = Nothing
End Sub |
je voudrai savoir s'il est possible sous excel de creer un BD automatiquement ou au moins une table avec ses champs car ca je n'ai pas reussi à trouver :?
Merci d'avance