voila ce que j ai ecrit
Sub importer()
Dim t As Date
Set wb = ThisWorkbook
sPath = wb.Path & Application.PathSeparator
res = FileLen(wb.Path & Application.PathSeparator & "données.txt")
While res = 0
res = FileLen(wb.Path & Application.PathSeparator & "données.txt")
Wend
t = Now + TimeValue("00:00:30")
If Range("a2").Value = 0 Then
Application.ScreenUpdating = False
Sheets("données").Select
Range("B7:D7000").Select
Selection.ClearContents
Range("B7").Select
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & wb.Path & Application.PathSeparator & "données.txt", Destination:=Range("$A$7"))
.Name = "données"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=True
End With
Cells.Select
Cells.EntireColumn.AutoFit
Sheets("recap").Select
Range("B30").Select
Application.ScreenUpdating = True
Application.OnTime t, "importer"
Else
Application.OnTime t, "importer", schedule:=False
Exit Sub
End If
End Sub
et voila la reponse d excel
erreur d execution 1004
la methode on time de l objet application a echoué