Dim NextTime Function ParseFiles() DirPath = "C:\Temp\" Filename = Dir(DirPath & "\*.txt") i = 0 Do ff = FreeFile Open DirPath & "\" & Filename For Input As #ff Line Input #ff, S1 If EOF(ff) Then Sv = Split(S1, ";") i = i + 1 Set rng = Cells(i, 1).Resize(1, UBound(Sv) + 1) rng.Value = Sv rng.Value = rng.Value End If Close #ff Filename = Dir() Loop Until Filename = "" End Function Sub StartScript() On Error GoTo NewTime ParseFiles NewTime: NextTime = Now + TimeValue("00:01:00") Application.OnTime EarliestTime:=NextTime, Procedure:="StartScript" End Sub Sub StopScript() On Error Resume Next Application.OnTime EarliestTime:=NextTime, Procedure:="StartScript", Schedule:=False End Sub |