Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileSystemObject: textfile contents erased

Status
Not open for further replies.

zimGirl

Geotechnical
Jul 22, 2004
30
Code:
Set fs = CreateObject("Scripting.FileSystemObject") 

        Set f = fs.GetFile(dlgMain.FileName)                

        Set a = f.OpenAsTextStream(varFileNum)

Hey guys,

When I open a file as a textstream (Code above) and hit the (X) to close the form and
exit program before using it in the program (Not Graceful exit), It erases the text
in the file and I get a blank file left over. (same name)

Is there something I am not doing at the end. Why does it erase the text in the file?
 
Replies continue below

Recommended for you

Are you closing the document first?

"Everybody is ignorant, only on different subjects." — Will Rogers
 
No I am not, how do I do close the document?
 
from your code, it would be...

a.close

"Everybody is ignorant, only on different subjects." — Will Rogers
 
hey borgunit,
Thanks for the help, worked great!!!
I had to close both the stream and the file
Code:
a.Close
Close #varFileNum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor