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
| Dim fs, f, sf, f1, s, lFicSou, lFicDest, ldir
ldir = "D:\temp\test"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(ldir)
Set sf = f.Files
For Each f1 In sf
If Mid(f1.Name, 1, 3) = "FIC" Then
MsgBox f1.Name
Set of = fs.OpenTextFile(f1.Path)
lFicSou = ldir & "\" & f1.Name
lFicDest = ldir & "\FIC_" & Mid(of.Readline, 4, 4) & ".dat"
While Not of.AtEndOfStream
MsgBox of.readline
Wend
s = s & f1.Name
s = s & vbCrLf
fs.CopyFile lFicSou, lFicDest
Fso.DeleteFile lFicSou
of.Close
End If
Next
MsgBox s |
Partager