1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Private Sub Form_Load()
'ceci : juste pour se constituer un petit fichier d'essai, hein ...
Open "d:\essai.txt" For Output As #1
Print #1, "bonjour"
Print #1, "c'est moi"
Print #1, "Message=hé bé ! me voilà!"
Print #1, "blablabla"
Close #1
End Sub
Private Sub Command1_Click()
Dim cherche As String, trouve As Boolean
cherche = "Message="
trouve = False
Open "d:\essai.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, titi
If titi Like cherche & "*" Then
toto = Mid(titi, Len(cherche) + 1)
trouve = True
Exit Do
End If
Loop
Close #1
MsgBox trouve
MsgBox toto
End Sub |