cs_barada
Messages postés54Date d'inscriptionvendredi 26 mars 2004StatutMembreDernière intervention13 août 2015
-
12 févr. 2007 à 14:08
cs_barada
Messages postés54Date d'inscriptionvendredi 26 mars 2004StatutMembreDernière intervention13 août 2015
-
14 févr. 2007 à 10:29
Bonjour le forum et Jean marc
Suite à ce fil Recherche par vbs du 27/12 - Les premiers test ont étéconcluant puisque je l' ai utilisé. Ce matin j' ai eu un probleme de Type Ubound à la ligne 37, je ne sais pas pourqoui.
Merci d' avance pour ton aide Jean Marc
If Fso.FileExists(Path & Fichier) Then
'-----------------------------------------------------------
'Lecture et mise en variable du contenu du fichier en entrée
'-----------------------------------------------------------
Const ForReading = 1
Dim objTextStream, i
Set objTextStream = Fso.OpenTextFile(Path & Fichier, ForReading)
Dim Fic()
ReDim Fic(0)
Do While Not ObjTextStream.AtEndOfStream
ReDim Preserve Fic(UBound(Fic) + 1)
Fic(UBound(Fic)) = ObjTextStream.ReadLine
Loop
objTextStream.Close
Set objTextStream = Nothing
For i=1 To UBound(Fic)
MsgBox "i=" & i &vbCrLf& Path & Fic(i)
If fso.FileExists(Path & Fic(i) & ".txt") Then
'If fso.FileExists(RepSauv & Fic(i) & ".txt") Then Fso.DeleteFile(RepSauv & Fic(i) & ".txt")
'fso.MoveFile Path & Fic(i) & ".txt", RepSauv & Fic(i) & ".txt"
End If
Next
End If
Set Fso = Nothing
If Fso.FileExists(Path & Fichier) Then
'-----------------------------------------------------------
'Lecture et mise en variable du contenu du fichier en entrée
'-----------------------------------------------------------
Const ForReading = 1
Dim objTextStream, i
Set objTextStream = Fso.OpenTextFile(Path & Fichier, ForReading)
Dim Fic()
ReDim Fic(0)
Do While Not ObjTextStream.AtEndOfStream
ReDim Preserve Fic(UBound(Fic) + 1)
Fic(UBound(Fic)) = ObjTextStream.ReadLine
Loop
objTextStream.Close
Set objTextStream = Nothing
For i=1 To UBound(Fic)
MsgBox "i=" & i &vbCrLf& Path & Fic(i)
If fso.FileExists(Path & Fic(i) & ".txt") Then
'If fso.FileExists(RepSauv & Fic(i) & ".txt") Then Fso.DeleteFile(RepSauv & Fic(i) & ".txt")
'fso.MoveFile Path & Fic(i) & ".txt", RepSauv & Fic(i) & ".txt"
End If
Next
End If
Set Fso = Nothing
cs_barada
Messages postés54Date d'inscriptionvendredi 26 mars 2004StatutMembreDernière intervention13 août 2015 13 févr. 2007 à 20:12
Bonsoir Jean marc
Merci de m' avoir répondu, j' ai fait un test ce soir, le msgbox
affiche bien les codes que je met dans le fichier txt, pas de méssages
de type Ubound, mais ile move des fichiers que je veuyx enlever ne se
fait.
Barada
Vous n’avez pas trouvé la réponse que vous recherchez ?
If Fso.FileExists(Path & Fichier) Then
'-----------------------------------------------------------
'Lecture et mise en variable du contenu du fichier en entrée
'-----------------------------------------------------------
Const ForReading = 1
Dim objTextStream, i
Set objTextStream = Fso.OpenTextFile(Path & Fichier, ForReading)
Dim Fic()
ReDim Fic(0)
Do While Not ObjTextStream.AtEndOfStream
ReDim Preserve Fic(UBound(Fic) + 1)
Fic(UBound(Fic)) = ObjTextStream.ReadLine
Loop
objTextStream.Close
Set objTextStream = Nothing
For i=1 To UBound(Fic)
''''' MsgBox "i=" & i &vbCrLf& Path & Fic(i)
If fso.FileExists(Path & Fic(i) & ".txt") Then
If fso.FileExists(RepSauv & Fic(i) & ".txt") Then Fso.DeleteFile(RepSauv & Fic(i) & ".txt")
fso.MoveFile Path & Fic(i) & ".txt", RepSauv & Fic(i) & ".txt"
End If
Next
Else
Msgbox "erreur: le fichier " & Path & Fichier & " n'existe pas"
End If
Set Fso = Nothing
Pour info:
' = rem pour mettre du commentaire dans un script
' fso.copyfile
ou
rem fso.copyfile