Dialogs Object (Excel)

A collection of all the Dialog objects in Microsoft Excel.


Each Dialog object represents a built-in dialog box. You cannot create a new built-in dialog box or add one to the collection. The only useful thing you can do with a Dialog object is use it with the Show method to display the dialog corresponding dialog box.

The Microsoft Excel Visual Basic object library includes built-in constants for many of the built-in dialog boxes. Each constant is formed from the prefix "xlDialog" followed by the name of the dialog box. For example, the Apply Names dialog box constant is xlDialogApplyNames, and the Find File dialog box constant is xlDialogFindFile. These constants are members of the XlBuiltinDialog enumerated type.


Use the Dialogs property to return the Dialogs collection. The following code example displays the number of available built-in Microsoft Excel dialog boxes.

MsgBox Application.Dialogs.Count

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

Sample code provided by: MVP Contributor Bill Jelen, MrExcel.com | About the Contributor

The following code example opens an e-mail message in Microsoft Outlook with the current workbook attached.

Sub SendIt() 
    Application.Dialogs(xlDialogSendMail).Show arg1:="ask@mrexcel.com", arg2:="This goes in the subject line" 
End Sub 

About the Contributor

MVP Bill Jelen is the author of more than two dozen books about Microsoft Excel. He is a regular guest on TechTV with Leo Laporte and is the host of MrExcel.com, which includes more than 300,000 questions and answers about Excel.

See Also


Excel Object Model Reference

Dialogs Object Members