Contents

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

### Syntax:

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

### Return type:

String

### Parameters:

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

#: Optional.

FileNumber: Required. Any valid file number.

### 錯誤代碼：

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

相關主題

Input# Statement

VBA I/O 函式