VBA reading from a text file

The code for reading from a text file looks like this:

Sub readtxtfile()

Defining constants
Const ForReading = 1, ForWriting = 2, ForAppending = 3

  Dim fs, f

Clear the sheet where results will be written. 65536 is the maximum line number before excel 2007. 

  Sheets("sheets 1").Rows("2:65536").Delete
 
  Set fs = CreateObject("Scripting.FileSystemObject")

  Set f = fs.OpenTextFile("file.txt", ForReading, TristateFalse)

Reading line by line until end of file.
  i = 2
  While f.AtEndOfStream <> True
      txt = Trim(f.readline)
      Sheets("sheets 1").Cells(i, 1) = txt
      i = i + 1
  Wend

End Sub

Enjoy.