Dialogs 物件 (Excel)Dialogs object (Excel)

在 Microsoft Excel 中所有**Dialog** 物件的集合。A collection of all the Dialog objects in Microsoft Excel.


每一個 Dialog 物件都代表內建對話方塊。Each Dialog object represents a built-in dialog box. 您不能建立新的內建對話方塊,也不能將內建對話方塊新增到集合中。You cannot create a new built-in dialog box or add one to the collection. 您可以運用Dialog物件的唯一有用件事是將它用於**Show** 方法來顯示 [對應] 對話方塊。The only useful thing that you can do with a Dialog object is to use it with the Show method to display the corresponding dialog box.

Microsoft Excel Visual Basic 物件程式庫包含了許多內建對話方塊的內建常數。The Microsoft Excel Visual Basic object library includes built-in constants for many of the built-in dialog boxes. 每一個常數都是以 "xlDialog" 字首開頭,後面再跟著對話方塊的名稱。Each constant is formed from the prefix "xlDialog" followed by the name of the dialog box. 例如,[套用名稱] 對話方塊常數是 xlDialogApplyNames,而 [尋找檔案] 對話方塊常數則是 xlDialogFindFileFor example, the Apply Names dialog box constant is xlDialogApplyNames, and the Find File dialog box constant is xlDialogFindFile. 這些常數是**XlBuiltinDialog** 列舉類型的成員。These constants are members of the XlBuiltinDialog enumerated type.


使用Application物件的**Dialogs** 屬性可傳回Dialogs集合。Use the Dialogs property of the Application object to return the Dialogs collection. 下列程式碼範例會顯示使用內建 Microsoft Excel 對話方塊數目。The following code example displays the number of available built-in Microsoft Excel dialog boxes.

MsgBox Application.Dialogs.Count

使用Dialogs (index),其中_index_是內建常數用來識別] 對話方塊] 方塊中,可以傳回單一Dialog物件。Use Dialogs (index), where index is a built-in constant identifying the dialog box, to return a single Dialog object. 下列範例會執行內建 [開啟舊檔對話方塊。The following example runs the built-in File Open dialog box.

dlgAnswer = Application.Dialogs(xlDialogOpen).Show


另請參閱See also

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.