Open a text file FAST!

By | 2002-06-01

Opens a text file much fast than a “Do While Not EOF(filenumber)” loop. Makes
file load times almost non-existant.

Original Author: Timothy Pew

Inputs

The filename of the file to open.

Assumptions

The filename that you pass to the function must exist, otherwise an error will occur.

Returns

The text contained in the file.

Side Effects

I have yet to run into any. If you do happen to find one leave a comment and
I will fix it.

Code

Public Function OpenFile(ByVal file As String) As String
Dim i As Integer
i = FreeFile
Open file For Input As #i
OpenFile = Input(LOF(i), i)
Close #i
End Function

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.