Home > Forum Home > Automating Data Analysis Tasks > Creating a continuously updating excel document > Use the FileSystemObject Share

Use the FileSystemObject

Excel Help for Use The Filesystemobject in Automating Data Analysis Tasks


Forum TopicLogin

Use The Filesystemobject

Rate this:
(3/5 from 1 vote)
HappyYou can read from a CSV or text file within Excel VBA code by using the FileSystemObject to read from the file line by line and then do what you like with the data read in Excel. e.g.

VBA Code:
Dim fso As New FileSystemObject
Dim fld As Folder
Dim ts As TextStream
Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set ts = fso.OpenTextFile("C:\Temp\temp.txt", ForReading)

While Not ts.AtEndOfStream
    Debug.Print ts.ReadLine
Wend

ts.Close

 Excel Business Forums Administrator
 Posted by on
 
View Full Post

Find relevant Excel templates and add-ins for Use the FileSystemObject in the