Enfin une fois faite la transfo en texte, reste a exécuter la fusion :
Private Sub fusionner()
Dim str_Pattern, str_Path As String
str_Pattern = "*.mtn.doc.txt"
str_Path = "c:\test\" 'a toi de préciser
Dim int_I, int_J As Integer
int_I = 1
Dim filesys, text, readfile, contents
Dim MyData
Set filesys = CreateObject("Scripting.FileSystemObject")
With Application.FileSearch
.NewSearch
.LookIn = ThisWorkbook.Path
.SearchSubFolders = False
.Filename = str_Pattern
.MatchTextExactly = True
' .FileType = msoFileTypeOfficeFiles
End With
With Application.FileSearch
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Set readfile = filesys.OpenTextFile(.FoundFiles(i), 1, False)
contents = readfile.ReadLine
readfile.Close
Set readfile = Nothing
contents = Replace(contents, ";", Chr(9))
contents = Replace(contents, Chr(34), "")
MyData = Split(contents, Chr(9))
For int_J = 0 To UBound(MyData)
ThisWorkbook.Sheets(1).Cells(int_I, int_J + 1).Value = MyData(int_J)
Next int_J
int_I = int_I + 1
Next i
Else
MsgBox "Aucun fichier trouvé."
End If
End With
End Sub
et tout marche chez moi
Irem