輸入方塊(InputBox)

TABLE OF CONTENTS

一、語法

參數

二、範例

範例 1:基本的輸入方塊

一、語法

官方連結:英文

Function InputBox(

Prompt As Variant

[,Title As Variant = "Microsoft Excel" 或 "Microsoft Word" 等]

[,Default As Variant]

[,XPos As Variant]

[,YPos As Variant]

[,HelpFile As Variant, Context As Variant]

) As String

參數

名稱

型別

性質

說明

Prompt

String

必要性

訊息內容

Title

String

選擇性

標題

Default

String

選擇性

文字方塊內的預設內容

XPos

long

選擇性

視窗位置的 X 軸

YPpos

long

選擇性

視窗位置的 Y 軸

HelpFile

String

選擇性

說明主題的檔案

Context

Long

選擇性

說明主題的編號

二、範例

範例 1:基本的輸入方塊

Response = InputBox(Prompt:="訊息內容", Title:="標題", Default:="預設輸入內容")

或簡寫成

Response = InputBox(Prompt:="訊息內容", Title:="標題", Default:="預設輸入內容")