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 29 30 31 32
| Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f , f1, f2
Dim tab ,tab1
'on error resume next
Set objDictionary = CreateObject("Scripting.Dictionary")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("toto.txt", ForReading)
Set f1 = fso.OpenTextFile("tata.txt", ForReading)
Set f2 = fso.CreateTextFile("titi.txt")
f2.Close
Set f2 = fso.OpenTextFile("titi.txt", ForWriting)
i = 0
Do Until f.AtEndOfStream
ligne = f.ReadLine
tab = Split(ligne , ",")
licences = tab(0)
login = tab(1)
objDictionary.Add i, login
i = i + 1
Loop
Do until f1.AtEndOfStream
lignes = f1.ReadLine
tab1 = Split(lignes , ",")
nom = tab1(0)
loggin = tab1(1)
If objDictionary.exists(loggin ) Then
f2.WriteLine lignes
End If
Loop
f2.Close
f.Close
f1.Close |
Partager