enjoy!
codice:
Option Explicit
Const ForReading = 1
Dim arrOne(), arrTwo()
Dim file1, file2
Dim fso, sOne, sTwo
Dim i, j
Dim trovato
Dim msg
file1 = "C:\Documents and Settings\Alethesnake\Desktop\file1.txt"
file2 = "C:\Documents and Settings\Alethesnake\Desktop\file2.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set sOne = fso.OpenTextFile(file1, ForReading)
Set sTwo = fso.OpenTextFile(file2, ForReading)
i = 0
Do While Not (sOne.AtEndOfStream And sTwo.AtEndOfStream)
If Not sOne.AtEndOfStream Then
ReDim preserve arrOne(i)
arrOne(i) = Trim(sOne.readLine() & "")
End If
If Not sTwo.AtEndOfStream Then
ReDim preserve arrTwo(i)
arrTwo(i) = Trim(sTwo.readLine() & "")
End If
i = i + 1
loop
sOne.Close: Set sOne = Nothing
sTwo.Close: Set sTwo = Nothing
Set fso = Nothing
msg = ""
For i = 0 To UBound(arrOne)
trovato = False
For j = 0 To UBound(arrTwo)
If arrOne(i) = arrTwo(j) Then
trovato = True
Exit For
End If
Next 'j
If Not trovato Then
msg = msg & (i + 1) & ", "
End If
Next 'i
If msg = "" Then
MsgBox "Tutte le righe del file: " & vbcrlf & file1 & vbcrlf & _
"si trovano anche nel file: " & vbcrlf & file2 & vbcrlf & _
"(ATTENZIONE: non vale il viceversa!)", _
vbInformation
Else
msg = Left(msg, Len(msg) - 2)
MsgBox "Le righe: " & vbCrlf & msg & vbCrlf & _
"del file: " & vbCrlf & file1 & vbCrlf & _
"non sono presenti nel file: " & vbCrlf & file2 & vbCrlf, _
vbInformation
End If