FANDOM


Description Edit

Returns the content of an entire text file.


Code Edit

Function OpenTextFile(ByVal FileName As String)

Dim FB As Integer, FileData As String, LineData As String
FB = FreeFile
Open FileName For Input As #FB
Do Until EOF(FB)
    If FileData <> "" Then FileData = FileData & vbCrLf
    Line Input #FB, LineData
    FileData = FileData & LineData
Loop
Close #FB
OpenTextFile = FileData
End Function