Guida di LibreOfficeDev 7.4
Restituisce un valore selezionato da un elenco di argomenti.
Choose (Index As Integer, Expression1[, Expression2, ... [, Expression_n]]) As Variant
Variant. A value inferred from the Index parameter.
Index: Any numeric expression rounded to a whole number. Index accepts integer values starting at 1 that specify which of the possible choices to return.
Expression1, Expression2, …, Expression_n: Expressions representing each of the possible choices.
La funzione Choose restituisce un valore dall'elenco delle espressioni in base al valore dell'indice. Se Indice = 1, la funzione restituisce la prima espressione dell'elenco, se Indice = 2 restituisce la seconda espressione, ecc.
Se il valore di Indice è minore di 1 o maggiore del numero delle espressioni elencate, la funzione restituisce il valore Null.
Error #5 occurs when parameters are omitted. Error #13 occurs if Index equals Null.
The following example uses the or Choose function to select a string from several strings that form a menu:
Sub ExampleChoose
Print ChooseMenu(2) ' "Save Format"
MsgBox Choose(index := -5, 9, "Basic", PI) ' Null
MsgBox Choose(index := 3.14, 9, "Basic", PI) ' PI
End Sub
Function ChooseMenu(Index As Integer)
ChooseMenu = Choose(Indice, "Formattazione rapida", "Formato di salvataggio", "Formato di sistema")
End Function