1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Option Explicit
Const NomFich = ".\Badge.txt"
Const ForReeading = 1
Dim strSearch, Table, Nom, Prenom, ID, fso, Fich, Ret, Reponse
Set fso = CreateObject("Scripting.FileSystemObject")
Set Fich = fso.OpenTextFile(NomFich, ForReeading, False)
Reponse = InputBox("Donner l'ID de la personne à chercher:", "ID")
If Reponse = "" Then WScript.Quit
strSearch = Reponse
Do While Not Fich.AtEndOfStream
Ret = Fich.ReadLine
If InStr(1, Ret, strSearch, vbTextCompare) > 0 Then
Table = Split(Ret, ";")
Nom = Table(0)
Prenom = Table(1)
ID = Table(2)
Exit Do
End If
Loop
MsgBox "Nom : " & Nom & vbNewLine & "Prenom : " & Prenom & vbNewLine & "ID : " & ID, vbOKOnly, "Infos" |
Partager