Class Dialog (Word VBA)

The class Dialog represents a built-in dialog box. The Dialog object is a member of the Dialogs collection. The Dialogs collection contains all the built-in dialog boxes in Word. You cannot create a new built-in dialog box or add one to the Dialogs collection.

Set

To use a Dialog class variable it first needs to be instantiated, for example

Dim dlg as Dialog
Set dlg = Dialogs(Index:=1)

The following procedures can be used to set variables of type Dialog: Dialogs.Item and Application.Dialogs

For Each

Here is an example of processing the Dialog items in a collection.

Dim dlg As Dialog
For Each dlg In Dialogs
	
Next dlg

Properties

CommandBarId returns a Long that represents the toolbar control id for a built-in Microsoft Word dialog box.

Dim lngCommandBarId As Long
lngCommandBarId = Dialogs(1).CommandBarId

CommandName returns the name of the procedure that displays the specified built-in dialog box.

Dim strCommandName As String
strCommandName = Dialogs(1).CommandName

DefaultTab returns or sets the active tab when the specified dialog box is displayed.

Dialogs(1).DefaultTab = wdDialogEmailOptionsTabQuoting

Parent returns an object that represents the parent object of the specified Dialog object.

Dim objParent As Object
Set objParent = Dialogs(1).Parent

Type returns the type of built-in Microsoft Word dialog box.

Dim wwdType As WdWordDialog
wwdType = Dialogs(1).Type

Dialogs.Count returns a Long that represents the number of dialog boxes in the collection.

Dim lngCount As Long
lngCount = Dialogs.Count

Dialogs.Parent returns an object that represents the parent object of the specified Dialogs object.

Dim objParent As Object
Set objParent = Dialogs.Parent