Sometimes you just want to read in a complete text file from your PC without muddling through all the records (i.e. text lines) one by one. When you open a text file in binary mode, such things like EOL won't get special attention and you can read in the text as one big chunk.
This function takes the path and name of a text file as input and returns the text of this file as a string:
'Reads a text file and returns the text as string
'i_FileName contains full name (i.e. with path) of the file to be read
Public Function ReadTextFile(ByVal i_FileName As String) As String
Dim myFNo As Integer 'file number to open file
Dim myText As String 'string where text gets read into
'only open file if it can be found
If Dir(i_FileName, vbNormal) <> "" Then
'obtain the next available file number
myFNo = FreeFile
'open file in binary mode
Open i_FileName For Binary As #myFNo
'initialize string to receive text with
'as many spaces as the file has bytes
myText = Space(LOF(myFNo))
'read everything at once
Get #myFNo, , myText
'close file
Close #myFNo
'return text
ReadTextFile = myText
End If
End Function