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!

could someone get this script working

Status
Not open for further replies.

abhayrao

Technical User
Nov 5, 2002
16
0
0
IN
Hey!could someone get this script working for me.It is a script to write user input to a text 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 ="C:\WINDOWS\Desktop\New text Document(5)"
Set ts = fs.OpenTextFile(afile, 8 , -1)

ts.WriteLine title
ts.WriteBlankLines(1)
ts.WriteLine paragraph
ts.Close
 
I may be missing something but this worked for me fine - I had to change the path from c:\windows\ as I am running on Win2K - but pointing at "C:\New Text Document(5)" it worked. It created the file first time and then appended subsequent input to the text file. Might be a good idea to add the .txt to filename or you have to keep doing Open With to view.

Post if there is another problem and be specific......

Thanks
Sunny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top