Bonjour,
J'ai un problème lors de l'importation de mon fichier Excel vers Access.
Voici mon code avec l'erreur en gras
Public Function AlimenterFeuille(xlWorkSheet As Excel.Worksheet, NomFeuille As String) As Excel.Worksheet
'Supprimer enreg table T_Import_Brut
DoCmd.RunSQL "DELETE * FROM Produits"
Dim strPathToFiles As String
Dim onglet As String
Dim Repertoire As String, Fichier As String
Repertoire = "B:\A\B\FC\APPLI_FC25\Appli annexe IFRS\Excel\"
Fichier = Dir(Repertoire & "Annexes Passif Provisions et CA" & "*.xls")
MsgBox Repertoire & Fichier
strPathToFiles = Repertoire & Fichier
Set xlAppl = CreateObject("Excel.Application")
Set xlWorkbook = xlAppl.Workbooks.Open(strPathToFiles)
For Each xlWorkSheet In xlWorkbook.Worksheets
If xlWorkSheet.Visible = True Then
onglet = xlWorkSheet.Name
If onglet = "Produit" Then
' transfert vers table T_Import_Brut
DoCmd.TransferSpreadsheet acImport, 8, "Produits", strPathToFiles, False, onglet & "!A2:I3618"
End If
End If
Next xlWorkSheet
xlWorkbook.Close
xlAppl.Quit
Set xlWorkbook = Nothing
Set xlAppl = Nothing
Fichier = Dir
End Function
Erreur :
Erreur de compilation :
Affectation à une constante non autorisée
J'ai besoin d'aide s'il vous plait.
Benoit.
Enlèves tes doigts sales de mon clavier.Configuration: Windows XP
Internet Explorer 6.0