Input Function [VBA]

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

๊ฒฝ๊ณ  ์•„์ด์ฝ˜

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 ํŒŒ์ผ ๋(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