Input Function [VBA]

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

warning

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


Szintaxis:

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

Visszatérési érték:

String

Paraméterek:

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

#: opcionális.

FileNumber: Required. Any valid file number.

Hibakódok:

6 Túlcsordulás

52 Érvénytelen fájlnév vagy fájlszám

62 Olvasás a fájl vége (EOF) után

Példa:

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

Támogasson minket!