INPUT - Function

INPUT(number, [#] filenumber)

Reads a number of characters from a file (String).


numberThe number of characters to return (Integer).
filenumberThe number of the file (Integer).

REMARKS
* For an example refer to the page under Reading Text Files
* The "number" can be any numeric expression.
* This function can only be used with files opened with either Sequential/Input or Binary access.
* With files opened for binary access, an attempt to read through the file using this function until EOF returns True, will generate an error.
* You can use the CLOSE statement to close a text file.
* You can use the LINE INPUT statement to reads a single line from an Open sequential file and assigns it to a string.
* You can use the OPEN statement to open a text file.
* You can use the INPUT Statement to read data from a file and assigns the data to a list of variables (Long).
* You can use the INPUTB function that is used with byte data.
* You can use the INPUT$ function to return a String data type instead of a Variant data type.
* You can use the INPUTB$ function to return a String data type instead of a Variant data type.
* You can use the PRINT statement to write data to a file opened with Sequential access (display-formatted).
* You can use the PUT statement to write data from a record into a text file.
* The equivalent .NET function is [[Microsoft.VisualBasic.FileSystem.Input]]
* This function is not available in Access.
* For the Microsoft documentation refer to learn.microsoft.com

Dim MyChar As String 
Open "C:\Temp\MyText.txt" For Input As #1
Do While Not EOF(1)
    MyChar = Input(1, #1)
    Debug.Print MyChar
Loop
Close #1

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