{
Open "filename" for input as #1
input #1, variable
}
each time you run the input command it reads a new line so you can loop it until EOF to read the whole file
A faster way (if you are interested in reading more than the first line) is to read the entire file in one operation and place it in an array....
[tt]
Fname$ = "MyFile.txt"
ff = FreeFile
Open Fname$ For Binary As #ff
Raw$ = String$(LOF(ff), 32)
Get #ff, 1, Raw$
Close #ff
Txt$ = Split(Raw$, vbCrLf)
[/tt]
....later, you would reference the contents of the first line with Txt$(0), the second line with Txt$(1), etc.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.