Funkce InputBox

Zobrazí dialogové okno s výzvou umožňující uživateli zadat text do pole. Vstup je přiřazen proměnné.

Příkaz InputBox je vhodná metoda pro zadávání textu v dialogu. Vstup potvrdíte klepnutím na OK nebo stiskem klávesy Enter. Vstup získáte jako návratovou hodnotu funkce. Pokud zavřete dialog pomocí Zrušit, InputBox vrátí řetězec nulové délky ("").

Syntaxe:


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

Parametry:

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.

Návratová hodnota:

Řetězec

Příklad:


Sub ExampleInputBox
Dim sText As String
    sText = InputBox ("Zadej heslo:","Drahý uživateli")
    MsgBox ( sText , 64, "Opakuj heslo")
End Sub