Fonction InputBox

Affiche une invite dans une boîte de dialogue permettant à l'utilisateur de saisir du texte. L'entrée est assignée à une variable.

L'instruction InputBox permet de saisir facilement du texte au moyen d'une boîte de dialogue. Pour confirmer l'entrée, cliquez sur OK ou appuyez sur Entrée. L'entrée est renvoyée en tant que valeur de retour de la fonction. Si vous fermez la boîte de dialogue en cliquant sur Annuler, InputBox renvoie une chaîne de longueur zéro ("").

Syntaxe :


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

Paramètres :

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.

Valeur de retour :

Chaîne de caractères

Exemple :


Sub ExampleInputBox
Dim sText As String
    sText = InputBox ("Veuillez entrer une formule : ","Chère utilisatrice, cher utilisateur")
    MsgBox ( sText , 64, "Confirmation de formule")
End Sub