傳回從引數清單中選取的值。
Choose (Index, Selection1[, Selection2, ... [,Selection_n]])
Index:用於指定傳回值的數值表示式。
Selection1:包含一個可能選項的任意表示式。
Choose 函數將依 Index 值從表示式清單中傳回一個值。如果 Index 值小於 1 或者大於列出的表示式數,則函數傳回空值。
下面範例中的 Choose 函數將從構成功能表的數個字串中選取一個字串:
錯誤代碼
5 無效的程序呼叫
Sub ExampleChoose
Dim sReturn As String
sReturn = ChooseMenu(2)
Print sReturn
end sub
Function ChooseMenu(Index As Integer)
ChooseMenu = Choose(Index, "Quick Format", "Save Format", "System Format")
End Function