Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SkipLine in fso

Status
Not open for further replies.

BenniP

Technical User
Nov 18, 2001
39
DE
Hello,

in my script i write a line in a textfile, ask the user something, and write again a line. but the last line must be under the first line. if i use skipline it always give me an error.
here is the code:
Set fs = CreateObject("scripting.filesystemobject")
Set datei = fs.createtextfile("C:\Test.txt", True)
datei.skipline
datei.writeline "Test"
datei.Close

BenniP
 
i thought about that. but it must leave the first line as it is.

BenniP
 
BenniP,

Are you closing the file and re-opening it after you write the first line or are you leaving it open, writing a line, ask a question and then write the second results?


fengshui_1998
 
i close it after i write the first text, and then reopen it.

BenniP
 
If your re-opening the file, just use append.
if you need to skip a line, write a blank line
with fs.writeline ""

hth

 
here's a a bit of my code:
Set fs = CreateObject("scripting.filesystemobject")
If fs.fileexists("C:\test.txt") Then
Set datei = fs.opentextfile("C:\test.txt")
datei.writeline "Test"
datei.Close
End If

If fs.fileexists("C:\test.txt") Then
Set datei = fs.opentextfile("C:\test.txt")
datei.writeline ""
datei.writeline "Test Nr.2"
datei.Close
End If

is that right? or is there something wrong?

thanks for your answer

bennip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top