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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| Call KillProcess("EXCEL.EXE")
fichier = ImportExcel(Me.hwnd, "Importer des fiches contacts", "Allez Cherchez le fichier", "C:\")
'DoCmd.TransferSpreadsheet acImport, 8, "CLIENTS_TEST", fichier, True
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application") ' Ouverture d'excel
If Not xlApp Is Nothing Then
Set xlBook = xlApp.Workbooks.Open(fichier, False, True) 'Ouverture du classeur
If Not xlBook Is Nothing Then
Set xlSheet = xlBook.Worksheets("CLIENTS")
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![num] = xlSheet.Range(xlSheet.Cells(A, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![nom] = xlSheet.Range(xlSheet.Cells(D, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![adresse] = xlSheet.Range(xlSheet.Cells(E, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![cp] = xlSheet.Range(xlSheet.Cells(F, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![ville] = xlSheet.Range(xlSheet.Cells(G, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![selcom] = xlSheet.Range(xlSheet.Cells(B, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![seldep] = xlSheet.Range(xlSheet.Cells(H, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![numcom] = xlSheet.Range(xlSheet.Cells(B, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![dep] = xlSheet.Range(xlSheet.Cells(H, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![seltyp] = xlSheet.Range(xlSheet.Cells(C, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![selpays] = xlSheet.Range(xlSheet.Cells(i, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![tel] = xlSheet.Range(xlSheet.Cells(K, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![fax] = xlSheet.Range(xlSheet.Cells(L, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![port] = xlSheet.Range(xlSheet.Cells(M, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![email] = xlSheet.Range(xlSheet.Cells(N, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![site] = xlSheet.Range(xlSheet.Cells(O, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![selforme] = xlSheet.Range(xlSheet.Cells(P, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![SIRENN] = xlSheet.Range(xlSheet.Cells(Q, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![naf] = xlSheet.Range(xlSheet.Cells(R, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![PDG] = xlSheet.Range(xlSheet.Cells(S, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![DG] = xlSheet.Range(xlSheet.Cells(T, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![ACHETEUR] = xlSheet.Range(xlSheet.Cells(U, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![MARKETING] = xlSheet.Range(xlSheet.Cells(V, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![PACKAGING] = xlSheet.Range(xlSheet.Cells(W, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![QUALITE] = xlSheet.Range(xlSheet.Cells(X, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![PRODUCTION] = xlSheet.Range(xlSheet.Cells(Y, 2))
Forms![MENU_GENERAL]![SAISIE_CLIENTS]![SAISIE_INFORMATIONS]![groupefi] = xlSheet.Range(xlSheet.Cells(j, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_FINANCIERE]![CA] = xlSheet.Range(xlSheet.Cells(Z, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_FINANCIERE]![caflexo] = xlSheet.Range(xlSheet.Cells(AA, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_FINANCIERE]![cahelio] = xlSheet.Range(xlSheet.Cells(AB, 2))
Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_FINANCIERE]![caoffset] = xlSheet.Range(xlSheet.Cells(AC, 2))
' Fermeture des élements
xlBook.Saved = True
Set xlSheet = Nothing
Set xlBook = Nothing
xlApp.Quit
Set xlApp = Nothing
End If
End If |
Partager