Sub filtre()
Open “D:/licenceTAL/xxx/dh89.txt” For Input As 1
Open “D:/licenceTAL/xxx/filtre.txt” For Output As 2
b$ = InputBox$(”Entrez une forme”, “Filtrage”, “homme”)
compteur = 0
While (EOF(1) = 0)
Line Input #1, a$
k = InStr(a$, b$)
If k > 0 Then
compteur = compteur + 1
Print #2, “occurrence “, compteur, a$
End If
Wend
If compteur = 0 Then
MsgBox$ (”le mot n’apparait pas dans le texte”)
Else
MsgBox$ (”le mot ” + b$ + “a été trouvé ” + Str(compteur) + ” fois”)
End If
Close (1)
Close (2)
End Sub