LINE INPUT(# filenumber, varname)

Reads a single line from an Open sequential file and assigns it to a string.

filenumberThe number of the file (Integer).
varnameThe variable to contain the line of text (String).

* The line of text must end with a carriage return or carriage return line feed from an open disk corresponding to the filenumber.
* You can use the CLOSE statement to close a text file.
* You can use the OPEN statement to open a text file or csv file.
* The equivalent .NET function is Microsoft.VisualBasic.FileSystem.LineInput
* For the Microsoft documentation refer to

Dim TextLine As String 

Open "C:\Temp\MyText.txt" For Input As #1

Do While Not EOF(1)
   Line Input #1, TextLine
   Debug.Print TextLine

VBA.Close #1

© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited Top