Bonjour, mon souci est le suivant :
1. Je dois importer un fichier Excel
2. Je récupère les informations de cellules données
3. Je mets le résultat dans les champs d'un formulaires

Le souci est que ça ne marche pas tout le temps j'ai le message d'erreur suivant : Erreur d'exécution '462' : Le serveur distant n'existe pas ou n'est pas disponible

J'ai lu sur certains forum qu'il fallait tuer le processus mais ça ne fonctionne pas.

Config : WinXP Pro avec Access 2003 Pro

Je transmets le code également Merci à tous

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
fichier = ImportExcel(Me.hwnd, "Importer des fiches contacts", "Allez Cherchez le fichier", "C:\")
 
    Dim AppExcel As Excel.Application
    Dim wbFile As Excel.Workbook
 
    Set AppExcel = CreateObject("Excel.Application")  ' Ouverture d'excel
 
    If Not AppExcel Is Nothing Then
            Set wbFile = AppExcel.Workbooks.Open(fichier, False, True) 'Ouverture du classeur
            If Not wbFile Is Nothing Then
 
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![num] = Range("A2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![nom] = Range("D2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![adresse] = Range("E2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![cp] = Range("F2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![ville] = Range("G2")
 
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![selcom] = Range("B2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![seldep] = Range("H2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![numcom] = Range("B2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![dep] = Range("H2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![seltyp] = Range("C2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_OBLIGATOIRE]![selpays] = Range("I2")
 
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![tel] = Range("K2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![fax] = Range("L2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![port] = Range("M2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![email] = Range("N2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![site] = Range("O2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![selforme] = Range("P2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![SIRENN] = Range("Q2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![naf] = Range("R2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![PDG] = Range("S2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![DG] = Range("T2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![ACHETEUR] = Range("U2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![MARKETING] = Range("V2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![PACKAGING] = Range("W2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![QUALITE] = Range("X2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_INFORMATIONS]![PRODUCTION] = Range("Y2")
                Forms![MENU_GENERAL]![SAISIE_CLIENTS]![SAISIE_INFORMATIONS]![groupefi] = Range("J2")
 
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_FINANCIERE]![CA] = Range("Z2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_FINANCIERE]![caflexo] = Range("AA2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_FINANCIERE]![cahelio] = Range("AB2")
                Forms![MENU_GENERAL]![IMPORT_CLIENTS]![IMPORT_FINANCIERE]![caoffset] = Range("AC2")
 
                ' Fermeture des élements
                 wbFile.Close
                 AppExcel.Application.Quit
                 Set AppExcel = Nothing
            End If
    End If