Input Function [VBA]

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

warning

This function or constant 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 ΠŸΠ΅Ρ€Π΅ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅

52 ΠΠ΅ΠΏΡ€Π°Π²ΠΈΠ»ΡŒΠ½ΠΎΠ΅ имя ΠΈΠ»ΠΈ Π½ΠΎΠΌΠ΅Ρ€ Ρ„Π°ΠΉΠ»Π°

62 Π’Ρ‹Ρ…ΠΎΠ΄ Π·Π° Π³Ρ€Π°Π½ΠΈΡ†Ρ‹ ΠΌΠ°Ρ€ΠΊΠ΅Ρ€Π° ΠΊΠΎΠ½Ρ†Π° Ρ„Π°ΠΉΠ»Π°

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