Código
muchas gracias bye
Sub main() dim merge dim files dim i files = dir("C:\prueba\*.txt") i = 0 while (files(i) <> "") merge = arrJoin(fileText (files(i)), merge) msgbox merge(i) i = i + 1 wend dim lines lines = "" for j = 0 to uBound(merge) - 1 for k = 1 to uBound(merge) - 2 ' Compare each line of text file... if merge(j) = merge (k) then lines = lines & mid(merge (k),1,38) & mid(merge (k),48,810) end if next next 'guarda lo que ha leido dim fileName fileName ="C:\prueba\result.txt" saveAsFile fileName, lines end Sub function fileText(fileName) dim file, text dim forReading forReading = 1 set file = CreateObject("Scripting.FileSystemObject") set text = file.OpenTextFile(fileName, forReading) fileText = Split(text.ReadAll, vbLf) text.Close end function sub saveAsFile(fileName, text) dim file2, text2 dim forWriting forWriting = 2 set file2 = CreateObject("Scripting.FileSystemObject") set text2 = file.CreateTextFile (filename, forWriting ) writeline text text.Close end sub function arrJoin(array1, array2) dim newArray dim len1 dim len2 len1 = UBound(array1) len2 = UBound(array2) ReDim newArray(len1 + len2) for i = 0 to len1 - 1 int NewArray(i) = array1(i) next j = 0 for i = len1 to (len1 + len2) newArray(i) = array2(j) j = j + 1 next arrJoin = newArray end function