Contents

# InputBox Function

在對話方塊中顯示提示，使用者可以在其中輸入文字。輸入將被指定給變數。

使用 InputBox 陳述式是透過對話方塊輸入文字的一種便捷方法。按一下[確定]或按 RETURN 鍵確認輸入的內容。輸入將作為函式傳回值被傳回。如果使用 [取消] 關閉對話方塊，InputBox 將傳回一個長度為零的字串 ("")。

### Syntax:

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

### Parameters:

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 value:

字串型

### Example:

    Sub ExampleInputBox
    Dim sText As String
        sText = InputBox ("請輸入一字句： ","親愛的使用者")
        MsgBox( sText , 64, "Confirmation of phrase")
    End Sub