目录

# InputBox 函数

显示一个提示对话框，用户可以在其中输入文字。输入将被指定给变量。

使用「InputBox」语句是通过对话框输入文字的一种便捷方法。点击「确定」或按 Enter 键可以确认输入的内容。输入将作为函数返回值进行返回。如果使用「取消」关闭对话框，「InputBox」将返回一个长度为零的字符串 ("")。

### 语法:

    InputBox (Prompt As String[, Title As String[, Default As String[, xpostwips As Integer, ypostwips As Integer]]]) As String

### 参数:

prompt: String expression displayed as the message in the dialog box.

title: String expression displayed in the title bar of the dialog box.

default: String expression displayed in the text box as default if no other input is given.

xpostwips: Integer expression that specifies the horizontal position of the dialog. The position is an absolute coordinate and does not refer to the window of LibreOffice.

ypostwips: Integer expression that specifies the vertical position of the dialog. The position is an absolute coordinate and does not refer to the window of LibreOffice.

If xpostwips and ypostwips are omitted, the dialog is centered on the screen. The position is specified in twips.

### Return type:

字符串

### 示例:

    Sub ExampleInputBox
    Dim sText As String
        sText = InputBox ("请输入词语: ","亲爱的用户")
        MsgBox ( sText , 64, "词组确认")
    End Sub