Bonjour tous,
J’ai ces deux codes dans des modules qui fonctionnent très bien à l’état actuel (d’apres l’article d’Hervé Inisan du grenier):
Comme je l'ai dit le code fonctionne parfaitement, maintenant Je voudrai donner le choix à chaque utilisateur au bureau de choisir sur son poste le chemin de son fichier à importer par l’intermédiaire d’un filedialog boxe dans mon cas le nom est « CheminFichier » j’ai donc modifié le code comme suite :
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 Public Const SOURCE_PATH = "C:\Users\Mr DJELI\Desktop\ " Public Function SourcePath() If InStr(1, SOURCE_PATH, ":", vbTextCompare) > 0 Then SourcePath = SOURCE_PATH Else SourcePath = CurrentProject.Path & "\" & SOURCE_PATH End If End Function Et Sub MiseAJourFichierExcel() Dim tu As TableUpdater CurrentDb.Execute "DELETE * FROM [tbl_Productions]" Set tu = New TableUpdater With tu ' Fichier à importer (chemin, type, version) .Source = SourcePath() & "Productions.xlsx" .Range = "Productions!" .SourceType = Excel .ExcelVersion = acSpreadsheetTypeExcel12 .Headers = True .Target = "tbl_Productions" .TempTable = "tbl_Productions TEMP" .Import End With ' Message final BilanImportation tu ' Libérer les ressources Set tu = Nothing End Sub
.Source = " CheminFichier "
Mais cela ne fonction pas, j’ai besoin d’aides.
Partager