Input 函数 [VBA]

返回输入或二进制文件 (字符串) 的打开流。

warning

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


语法:

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

返回值:

String

参数:

数字」: 必填。数字表达式,指定要返回的字符数量。

#」: 可选。

FileNumber」: 必填。任意有效的文件数量。

错误代码:

6 溢出

52 错误的文件名或编号

62 读取内容超出 EOF

示例:

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

请支持我们!