VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Sample to Use Scripting.FileSystemObject Reference to Create/Read Text File

by M. Adeel [ The National College ] (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 28th June 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Sample to Use Scripting.FileSystemObject Reference to Create/Read Text File

API Declarations


Dim fso As FileSystemObject
Dim f As TextStream

Rate Sample to Use Scripting.FileSystemObject Reference to Create/Read Text File



Set f = fso.CreateTextFile("C:\new.txt")


f.WriteLine ("This is a Text File")
f.WriteLine ("This is a Text File")
f.WriteLine ("This is a Text File")
f.WriteLine ("This is a Text File")
f.WriteLine ("This is a Text File")
f.WriteLine ("This is a Text File")
f.WriteLine ("This is a Text File")


f.Close

Set f = fso.OpenTextFile("C:\new.txt", 1)
MsgBox f.ReadAll
f.Close

Set f = fso.OpenTextFile("C:\new.txt", ForAppending)
f.WriteLine ("This is new text")
f.Close

Set f = fso.OpenTextFile("C:\new.txt", 1)
MsgBox f.ReadAll
f.Close
End Sub

Download this snippet    Add to My Saved Code

Sample to Use Scripting.FileSystemObject Reference to Create/Read Text File Comments

No comments have been posted about Sample to Use Scripting.FileSystemObject Reference to Create/Read Text File. Why not be the first to post a comment about Sample to Use Scripting.FileSystemObject Reference to Create/Read Text File.

Post your comment

Subject:
Message:
0/1000 characters