import fichier excel après selection
Bonsoir,
Je cherche à importer un fichier excel après sélection de celui-ci.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Dim fDialog As Office.FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
.Title = "Veuillez sélectionner le fichier à importer"
.Filters.Clear
.Filters.Add "Access Databases", "*.XLSX"
.Filters.Add "Access Databases", "*.XLS"
If .Show = True Then
MsgBox .SelectedItems(1)
DoCmd.TransferSpreadsheet acImport, 8, .SelectedItems(1), True
End If
End With |
LE MsgBox m'affiche le bon nom de fichier avec le chemin devant, mais la commande transferspreadsheet me retourne une erreur avec en nom [chemin d'accès]\-1.xls au lieu du bon nom.
Avez-vous 1 idée du problème ?