Adding text to a text file using an inputbox

  • Thread starter Thread starter Proedrsmith
  • Start date Start date
P

Proedrsmith

Hello everyone,

I have an inputbox in VBScript, where the user inputs a location of a
file. If possible I'd like the info they enter to be added to a text
file. Any ideas?

Thanks,

proedrsmith
 
This is in VB script from an ASP page. You need windows scripting installed,
but you must have that to have posed the question.

Dim fso, f,strfile
strfile = "Path to your file here"

Set fso = createobject("Scripting.FileSystemObject")
set f = fso.opentextfile(strfile,8,true)
f.writeline "Your text here from the text box"
f.close
 
Sub AddText()
Dim S As String
Dim i As Integer
S = InputBox("Now what")
If S <> "" Then
i = FreeFile
Open "C:\Temp\MyLogg.txt" For Append As #i
Print #i, S
Close #i
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top