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 33 34 35 36 37 38 39 40 41 42 43 44
   | Function ReadData(sRep)
  Dim oFiles,oFile,oTFile,i,k,aBuffer
  Set oFiles = oFso.GetFolder(sRep).Files
  ReDim aData(oFiles.Count - 1,4)
  i = 0
  For Each oFile In oFiles
 
		Set oTFile = oFso.OpenTextFile(oFile.Path, ForReading)
		s = ""
 
		For k = 0 to 2
			aBuffer = Split(oTFile.ReadLine, ":")
			aData(i,k) = aBuffer(1) 		
		Next
		i = i + 1
 
		Set fso = CreateObject("Scripting.FileSystemObject")
		Set oFich = fso.OpenTextFile(oFile.Path, 1,True)
		tx = oFich.ReadAll
		oFich.Close    ' On ferme le fichier après en avoir lu le contenu
		tb = Split(tx,VbNewline)
		For h = 3 To UBound(tb) ' On commence à 3 qui correspond à la 4ème ligne  
								' puisque le premier index du tableau (tb) est 0(zéro)
			S = S+tb(h)+Vbnewline
		Next
 
		' Affichage du résultat
		MsgBox s
		vMsg = s
		' Nettoyage 
		Set oFich = Nothing
		Set fso = Nothing
 
	Next
End Function
 
ReadData(sRep)
For j = 0 to UBound(aData)
	' MsgBox aData(j,0) & " " &  aData(j,1) & " " &  aData(j,2) & " " &  aData(j,3)
	' Assignation des variables
	vExpediteur = aData(j,0)
	vDest = aData(j,1)
	vSujet = aData(j,2)
.... | 
Partager