View Single Post
  #7 (permalink)  
Old October 15th, 2004, 05:26 AM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

On close inspection I now see the problem is that you are trying to access the file twice (or three times). CreateTextFile already returns a textStream object, there's no need to re-acquire it.
Change:
Code:
file = myActiveXObject.CreateTextFile(filenameIs);
file = myActiveXObject.GetFile(filenameIs2);
text = file.OpenAsTextStream(ForWriting, TristateFalse);
to
Code:
var text = myActiveXObject.CreateTextFile(filenameIs); //use a second argument of true to overwrite old file
--

Joe