

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
3 messages in org.openoffice.fr.progRe: [prog] Faire une boucle| From | Sent On | Attachments |
|---|---|---|
| Françoise | Nov 16, 2006 9:39 pm | |
| Francois Gatto | Nov 16, 2006 10:32 pm | |
| Françoise | Nov 17, 2006 12:20 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [prog] Faire une boucle | Actions... |
|---|---|---|
| From: | Francois Gatto (oo...@volcar.org) | |
| Date: | Nov 16, 2006 10:32:22 pm | |
| List: | org.openoffice.fr.prog | |
Bonjour,
Françoise a écrit :
Bonjour,
J'ai besoin d'aide ! :)
J'ai fait une macro pour écrire le fichier formulaire.xml dans un nouveau fichier.
Je ne veux pas que la première ligne du fichier formulaire.xml s'incrive dans le fichier resultat.xml mais ensuite toutes les autres lignes doivent s écrirent. Pour le moment j'ai trouvé comment le faire manuellement, mais je dois dire que le fichier formulaire.xml contient énormement de lignes, il me semble plus justicieux de faire une boucle de la deuxième ligne à la dernière mais je n'y arrive pas, quelqu'un pourrait-il m'aider ?
Voici ma macro :
Sub Supprimer_premiere_ligne
Dim f1 As Integer, f2 as integer
Dim uneLigne As String
dim identite as string, resultat as string
identite = "C:\Documents and Settings\Françoise\Bureau\Formulaire\Sources\formulaire.xml"
f1 = FreeFile ' obtenir un numéro de fichier ouvert
Open identite For input As #f1
resultat = "C:\Documents and Settings\Françoise\Bureau\Formulaire\Sources\resultat.xml"
f2 = FreeFile ' obtenir un numéro de fichier ouvert
Open resultat For output As #f2
'*** Effacer la première ligne du fichier formulaire.xml
Line Input #f1, uneLigne '1
'***Ecrire toutes les autres lignes
Line Input #f1, uneLigne'2
Print #f2, uneLigne
Line Input #f1, uneLigne'3
Print #f2, uneLigne
Line Input #f1, uneLigne'4
Print #f2, uneLigne
Line Input #f1, uneLigne'5
Print #f2, uneLigne
Line Input #f1, uneLigne'6
Print #f2, uneLigne
Line Input #f1, uneLigne'7
Print #f2, uneLigne
Line Input #f1, uneLigne'8
Print #f2, uneLigne
MsgBox "Le fichier resultat.xml est maintenant dans le dossier Sources"
Close #f1
close #f2
end sub
Sub Supprimer_premiere_ligne Dim f1 As Integer, f2 as integer Dim uneLigne As String dim identite as string, resultat as string identite = "C:\Documents and Settings\Françoise\Bureau\Formulaire\Sources\formulaire.xml" f1 = FreeFile ' obtenir un numéro de fichier ouvert Open identite For input As #f1 resultat = "C:\Documents and Settings\Françoise\Bureau\Formulaire\Sources\resultat.xml" f2 = FreeFile ' obtenir un numéro de fichier ouvert Open resultat For output As #f2 '*** Effacer la première ligne du fichier formulaire.xml Line Input #f1, uneLigne '1 '***Ecrire toutes les autres lignes
While not eof(1) Line Input #f1, uneLigne'2 Print #f2, uneLigne Wend MsgBox "Le fichier resultat.xml est maintenant dans le dossier Sources" Close End Sub
-- Francois Gatto







