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
| Sub Imprt_Annomal()
Dim con As ADODB.Connection
Set con = CurrentProject.Connection
Dim chemin As String
Dim SourceFile, DestinationFile
'DoCmd.RunSQL ("drop table AnomalieEx")
'On Error Resume Next
chemin = InputBox("Entrer le Chemin relative au fichier Excel 'ANOMALIES'", _
"CHEMIN DE LA FEUILLE ANOMALIES")
SourceFile = chemin ' Définit le nom du fichier source.
DestinationFile = "\\MANEX\Import_Export\AnomaliEx.xls" ' Définit le nom du fichier cible dans le serveur.
' Copie le fichier source dans le fichier cible.
FileCopy SourceFile, DestinationFile
sql3 = "SELECT * INTO AnomalieEx FROM ANNOMAL_EXCEL_...[Feuil1$]"
DoCmd.RunSQL sql3
'ANNOMAL_EXCEL_ c'est le nom du serveur lié son chemin et le même du DestinationFile
MsgBox ("Importation Effectuée"), vbInformation, "IMPORTATION"
End Sub |
Partager