nicolasbonnet13
Messages postés6Date d'inscriptionjeudi 28 juillet 2005StatutMembreDernière intervention16 mai 2008
-
28 juil. 2005 à 14:01
nicolasbonnet13
Messages postés6Date d'inscriptionjeudi 28 juillet 2005StatutMembreDernière intervention16 mai 2008
-
28 juil. 2005 à 15:36
Voila je dois récupérer dans un fichier texte un paragraphe qui est identique dans tout mes fichiers texte, il commence par read scribe et se termine par la date de l'opération. Quelqu'un peux m'aider svp.
cs_insomnix
Messages postés20Date d'inscriptionlundi 28 juin 2004StatutMembreDernière intervention13 septembre 2005 28 juil. 2005 à 14:46
Salut, voila comment j'aurai fais. J'ai pas debug donc dis moi si il y a des probleme :
s_nomfic correspond a le chemin de ton fichier : (c:\monfichier.txt)
Public Function Paragraphe(byval s_nomfic as string) as string
Dim o_FileSystemObject As FileSystemObject
Dim o_TextStream As TextStream
Dim s_ligne As String
Set o_FileSystemObject = New FileSystemObject
Set o_TextStream = o_FileSystemObject.OpenTextFile(s_nomfic , ForReading, False, TristateUseDefault)
'jusque a la fin du fichier
Do While Not o_TextStream.AtEndOfStream
'lit la ligne
s_ligne = o_TextStream.ReadLine
'si la ligne contient le mot
if instr(s_ligne,"read scribe")<>0 then
'Faire jusqu' a l autre mot (date operation, a toi de mettre ce qu il faut)
Do While instr(s_ligne,"date de l'opération") = 0
'ajoute la ligne au paragraphe
Paragraphe = Paragraphe & s_ligne
'Ligne suivante
s_ligne = o_TextStream.ReadLine
Loop
endif
Loop
end Function