Fandom

Visual Basic Wiki

OpenTextFile

66pages on
this wiki
Add New Page
Talk0 Share

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

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.