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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to write to a text file 1

Status
Not open for further replies.

abhayrao

Technical User
Nov 5, 2002
16
0
0
IN
could you tell me how to write user input to a text file . I really need it.
-abhayrao
 
Here you go just change the path to where you want the file.
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const TristateFalse = 0
Const TristateTrue = -1
Const TristateUseDefault = -2
Dim title
Dim paragraph
Dim afile
Dim ts
Dim fs


title = "Writing to File"

paragraph = inputbox("enter your text")


Set fs = CreateObject("Scripting.FileSystemObject")
' open file to write to, create if not there, using ASCII
afile ="Your path to file"
Set ts = fs.OpenTextFile(afile, 8 , -1)

ts.WriteLine title
ts.WriteBlankLines(1)
ts.WriteLine paragraph
ts.Close






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top