Contido

# 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.

### Sintaxe:

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

### Return type:

String

### Parámetros:

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

#: Opcional.

FileNumber: Required. Any valid file number.

### Códigos de erro

6 Desbordamento

52 Erro no nome ou número do ficheiro

62 A lectura excede o fin do ficheiro

### Exemplo:

            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

Temas relacionados

Input# Statement

Funcións de E/S do VBA