Login | |
|
 |
RE: write into the first line of textfile - 6/26/2006 10:49:04 PM
|
|
 |
|
| |
mbouchard
Posts: 1903
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
|
Hmm, I hate when I can find a script. I believe that I had one that did this, but not sure where it is, so... To do this: 1) Open the CSV (Use ForReading) and put it into a variable using ReadAll Close CSV. 2) Open the CSV using ForWriting. Write what you want, then add in the Variable created above.
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
 |
RE: write into the first line of textfile - 6/27/2006 11:12:03 PM
|
|
 |
|
| |
zurheiden
Posts: 2
Score: 0
Joined: 6/26/2006
Status: offline
|
Thank you - i have found a solution: '****************************************************** Dim tb,fso,f1,f2,i,wert,a,leseDatei,CheckStr Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const TEMPDATEI= "U:\upload\zwischenablage.txt" Const DATENDATEI01= "U:\upload\teilnehmer.TXT" Const DATENDATEI02= "U:\upload\vorgang.TXT" Sub TextfileMod(File,Value) Set fso = CreateObject("Scripting.FileSystemObject") set leseDatei = fso.OpenTextFile(File,ForReading) CheckStr = LEFT(leseDatei.ReadLine,5) If CheckStr<>"1,2,3" Then Set f1 = fso.OpenTextFile(TEMPDATEI, ForWriting, True, 0) wert = "1" for i = 2 to Value wert = wert & "," & i next f1.Writeline "" & wert Set f2 = fso.OpenTextFile(File, ForReading) a = f2.ReadAll f1.Write a f1.close f2.close fso.CopyFile TEMPDATEI, File, True End If end Sub TextfileMod DATENDATEI01,28 TextfileMod DATENDATEI02,18 '****************************************************** Greetings Zurheiden
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|