Text Documents (Writer)
HTML Documents (Writer Web)
Spreadsheets (Calc)
Presentations (Impress)
Drawings (Draw)
Database Functionality (Base)
Formulae (Math)
Charts and Diagrams
Macros and Scripting
Office Installation
Common Help Topics
OneOffice Logo

Input Function [VBA]

Returns the open stream of an Input or Binary file (String).

This constant, function or object is enabled with the statement Option VBASupport 1 placed before the executable program code in a module.

Syntax:


        Input( Number as Integer, [# ] FileNumber as Integer)
    

Return value:

String

Parameters:

Number: Required. Numeric expression specifying the number of characters to return.

#: Optional.

FileNumber: Required. Any valid file number.

Error codes:

6 Overflow

52 Invalid file name or file number

62 Reading exceeds EOF

Example:


        REM ***** BASIC *****
        Option VBASupport 1
        Sub Example-Input
            Dim MyData
            Open "MyDataFile.txt" For Input As #1
            Do While Not EOF(1)
                MyData = Input(1, #1)
                Print MyData
            Loop
            Close #1
        End Sub