VBA Code:
Sub lirebenzing(nf)
With Sheets("résultats")
k = .Cells(Rows.Count, 1).End(xlUp).Row
Open nf For Input As 1
Do
Line Input #1, v
If v <> "" Then
q = Mid(v, 3, 7)
If q = "BENZING" Then
q = Mid(v, 57, 19)
de$ = Trim(Replace(Replace(Replace(q, ".", "/"), "-", " "), "|", ""))
nr = 0
sr = 0
Else
q = Left(v, 7)
If q = "Amateur" Then
propn = Mid(v, 56)
propn = Trim(propn)
propid = Mid(v, 17, 12)
xp = 0
yp = 0
setxyp propn, propid, xp, yp
Else
s = InStr(v, "Lieu de lacher")
If s <> 0 Then
s1 = InStr(v, ":")
lieuid = Mid(v, s1 + 1, s - s1 - 2)
lieun = Mid(v, s + 15)
lieun = Trim(lieun)
ElseIf lieuid <> "" And (Left(v, 3) = "No." Or Left(v, 3) = "Ord") Then
nr = 1
ElseIf Left(v, 3) = "---" Or Left(v, 3) = "+--" Then
If nr = 1 Then sr = 1
ElseIf Left(v, 3) = "+--" Or InStr(v, "Signatur") <> 0 Then
nr = 0
sr = 0
ElseIf sr = 1 Then
If Not dp Then
k = k + 1
.Cells(k, 1) = course
.Cells(k, 2) = datecourse
.Cells(k, 3) = "'" & propid
.Cells(k, 4) = propn
t = Split(v, "|")
.Cells(k, 5) = t(0)
.Cells(k, 5) = Val(.Cells(k, 5))
.Cells(k, 6) = "'" & t(6)
t1 = Split(suppresp(t(1)), " ")
.Cells(k, 7) = "'" & t1(1)
.Cells(k, 8) = "'" & t1(2)
.Cells(k, 9) = "'" & t1(3)
j = 4
While t1(j) = ""
j = j + 1
Wend
.Cells(k, 10) = "'" & t1(j)
.Cells(k, 11) = "'" & t(2)
.Cells(k, 12) = "'" & t(3)
If Left(t(4), 6) <> "pas ar" Then
.Cells(k, 13) = "'" & Left(t(4), 3)
.Cells(k, 14) = TimeValue(Mid(t(4), 6))
End If
.Cells(k, 16) = idcourse
.Cells(k, 17) = de
.Cells(k, 18) = "BENZING"
.Cells(k, 19) = nf
.Cells(k, 20) = x
.Cells(k, 21) = y
.Cells(k, 22) = xp
.Cells(k, 23) = yp
.Cells(k, 24) = Sqr((xp - x) ^ 2 + (yp - y) ^ 2)
If Val(.Cells(k, 5)) <> 0 Then
.Cells(k, 25) = .Cells(k, 14) - (datecourse - Int(datecourse))
.Cells(k, 26) = .Cells(k, 24) * 1000 / (.Cells(k, 25) * 24 * 60)
End If
End If
End If
End If
End If
End If
Loop While Not EOF(1)
Close
End With
End Sub