Public Sub ReadTxtFile()
Dim myFileSystemObject As FileSystemObject
Dim aFile As TextStream
Set myFileSystemObject = New FileSystemObject
Set aFile = myFileSystemObject.OpenTextFile("C:\myFile.txt", 1)
Do While Not aFile.AtEndOfStream
Debug.Print aFile.ReadLine
Loop
aFile.Close 'Close file and convert lines of data to columns
Set myFileSystemObject = Nothing
Set aFile = Nothing
End Sub
|