Click to See Complete Forum and Search --> : pass data
Cassius
12-20-2004, 04:00 AM
i would like that when i click a button on a form, i would type something to a textfile, so i tried putting the following to the onClick event of a button on a form but it did not work.
<script language="VBS">
Sub PassData()
open "C:\Documents And Settings\user\Desktop\Form.txt" FOR APPEND AS #1
Print #1, "test"
Close #1
End Sub
</script>
Can someone tell me what's wrong with the above ?
Thank You
scragar
12-20-2004, 04:28 AM
try setting the language to "VBscript", microslop products often require more nonsence than nessesary so use:
<script language="VBscript">
Sub PassData()
dim fileNo
fileNo = freefile
dim fileLoc
fileLoc = "C:\Documents And Settings\user\Desktop\Form.txt"
open fileloc FOR APPEND AS fileNo
Print fileNo, "test"
Close fileNo
End Sub
</script>
no guarentees though.
Cassius
12-20-2004, 04:37 AM
unfortuantely it didn't work neither.
russell
12-20-2004, 11:22 AM
try this
Sub PassData()
Dim fso
Dim tst
Set fso = createobject("Scripting.FileSystemObject")
Set tst = fso.OpenTextFile("C:\Documents And Settings\user\Desktop\Form.txt", 8, true)
tst.writeLine "test"
tst.close
set tst = nothing
set fso = nothing
End Sub
Won't work for any browser besides IE, and the MS Scripting runtime (scrrun.dll) must be installed and registered on the users PC.