Hello.
I need to open CSV file, find some "string" in a row and rename it.
For example
And I need to find string "the req ops" and change it for "OK"
Is it possible ?
I have some part of the code but not sure how to modify it.
but it doesn;t work
I need to open CSV file, find some "string" in a row and rename it.
For example
Code:
DATE;DEPART;CLASSE;SERVEUR;ERREURS;MESSAGE;SCHEDULE;TYP;DUREE;TAILLE(Kb);FICHIERS;RETENTION;WARS Date ouverture;WARS Date fermeture;Commentaires
2012-04-22;21:01:25;lala_nbondv02_data;nbondv02;0;the req ops;lmejvd-lala-2sem;lalaérentielle;00:12:53;1909225;1447;2 Sem
2012-04-22;21:00:00;lala_nbondv02_sys;nbondv02;0;the req ops;lmmjvd-lala-2sem;lalaérentielle;00:03:58;371778;2184;2 Sem
2012-04-22;21:00:59;lala_nbondv03_data;nbondv03;0;OK;lmejvd-lala-2sem;lalaérentielle;00:07:49;892604;6695;2 Sem
2012-04-22;21:00:00;lala_nbondv03_sys;nbondv03;0;OK;lmmjvd-lala-2sem;lalaérentielle;00:08:38;1209603;399;5 Sem
2012-04-22;21:00:57;lala_nbondv04_data;nbondv04;0;OK;lmejvd-lala-2sem;lalaérentielle;03:22:41;135497795;300;2 Sem
And I need to find string "the req ops" and change it for "OK"
Is it possible ?
I have some part of the code but not sure how to modify it.
Code:
Function OK()
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Rapport.csv", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
If InStr(strLine, "the req ops") Then
InStr(strLine, "OK")
End If
Loop
objFile.Close
Set objFile = objFSO.OpenTextFile("C:\Rapport.csv", ForWriting)
objFile.Write strNewContents
objFile.Close
End Function
but it doesn;t work