InputBox Function

ユーザーによるテキスト入力を行うためのダイアログを表示します。入力された値は、変数に収める必要があります。

InputBox ステートメントを利用することで、ダイアログによるユーザー入力を簡単に実装できます。ユーザーの入力する値は、OK ボタンをクリックするか Return キーを押した段階で確定されます。こうして得られる入力値は、一種の関数の戻り値として返されます。また、Cancel ボタンをクリックしてダイアログを閉じると、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

ご支援をお願いします!