範例
附註: 下列範例示範如何在 Visual Basic for Applications (VBA) 模組中使用此函數。 如需使用 VBA 的詳細資訊,請在 [搜尋] 旁的下拉式清單中選取 [開發人員參考],並在 [搜尋] 方塊中輸入一個或多個字詞。
此範例顯示使用 InputBox 函數來提示使用者輸入值的各種方式。 如果省略 x 和 y 位置,對話框會自動置中對個別座標軸。 變數 MyValue 包含使用者按兩下 [ 確定 ] 或按 ENTER 鍵時所輸入的值。 如果使用者按兩下 [取消],就會傳回零長度字串。
Dim Message, Title, Default, MyValue
Message = "Enter a value between 1 and 3" ' Set prompt.
Title = "InputBox Demo" ' Set title.
Default = "1" ' Set default.
' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)
' Use Helpfile and context.
' The Help button is added automatically.
MyValue = InputBox(Message, Title,,,,"DEMO.HLP", 10)
' Display dialog box at position 100, 100.
MyValue = InputBox(Message, Title, Default, 100, 100)
五年数据对比,哪个省份的人最“有钱”?
gta5买的飞机在哪