Here is the code. The comment line indicates where the error occurs, and its type. I hope that someone can tell me what is wrong.
<HTML>
<Head>
<Title>Saved Content</Title>
<Script Language=JavaScript></Script>
<Script language='VBScript'>
Sub saveThis_OnClick
isData = xferContent.innerHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set contentFile = fso.CreateTextFile("c:\My Documents\Test.txt",True)
contentFile.WriteLine(isData)
contentFile.Close
MsgBox "Successfully saved Test.txt in My Documents"
End Sub
Sub appendThis_onClick
isData = appendContent.innerHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set contentFile = fso.GetFile("c:\My Documents\Test.txt")
// ---- Why does this line cause an "invalid procedure call or argument" error ----
Set textStream = contentFile.OpenAsTextStream(ForAppending)
End Sub
</Script>
</Head>
<Body>
<center>
<Div id=xferContent>
This is some text
</Div>
<Div id=appendContent>
And this text will be appended to the existing file
</Div>
<br>
<input type=button id=saveBtn Name='saveThis' value='Save as a text file'>
<br><br>
<input type=button id=appendBtn value='Append this to text file' Name='appendThis'>
</center>
</Body>
</HTML>


Reply With Quote
Bookmarks