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
|
Sub Test()
Dim LaLigne As String, tablo As Variant
Dim Where_pos As Long
Dim End_Where As Long
Dim beg_ligne As String
Dim End_ligne As String
Open "C:\DATA\Test\Selective Sorties Mois 0.dqy" For Input As #1
Open "C:\DATA\Test\TonFichierCorrigé.txt" For Output As #2
Do While Not EOF(1)
Line Input #1, LaLigne
Where_pos = InStr(1, LaLigne, "WHERE", vbTextCompare)
If Where_pos > 0 Then
End_Where = InStr(Where_pos, LaLigne, ")", vbTextCompare)
If End_Where > 0 Then
beg_ligne = Left(LaLigne, Where_pos - 1)
End_ligne = Right(LaLigne, Len(LaLigne) - End_Where)
LaLigne = beg_ligne & "WHERE (LST_SORM1C.DEPAZT='605') OR (LST_SORM1C.DEPAZT='606') OR (LST_SORM1C.DEPAZT='615')" & End_ligne
End If
End If
Debug.Print LaLigne
Print #2, LaLigne
Loop
Close #1
Close #2
Kill "C:\TonRep\TonFichier.dqy"
Name "c:\TonRep\TonFichierCorrigé.txt" As "C:\TonRep\TonFichier.dqy"
End Sub |