Input Function [VBA]

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

warning

Aquesta constant, funció o objecte s'activa mitjançant l'expressió Option VBASupport 1, col·locada abans del codi executable del programa en un mòdul.


Sintaxi:

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

Valor de retorn:

String

Paràmetres:

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

#: opcional.

FileNumber requerit. Qualsevol número de fitxer vàlid.

Codis d'error

6 Desbordament

52 El nom o el número del fitxer és incorrecte

62 La lectura excedeix el final del fixer (EOF)

Exemple:

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

Ens cal la vostra ajuda!