Partager via


FileDialog.DialogType Property (Office)

Gets an MsoFileDialogType constant representing the type of file dialog box that the FileDialog object is set to display. Read-only.

Syntax

expression .DialogType

expression A variable that represents a FileDialog object.

Example

The following example takes a FileDialog object of an unknown type and runs the Execute method if it is a SaveAs dialog box or an Open dialog box.

Sub DisplayAndExecuteFileDialog(ByRef fd As FileDialog) 
 
 'Use a With...End With block to reference the FileDialog object. 
 With fd 
 'If the user presses the action button... 
 If .Show = -1 Then 
 
 'Use the DialogType property to determine whether to 
 'use the Execute method. 
 Select Case .DialogType 
 Case msoFileDialogOpen, msoFileDialogSaveAs: .Execute 
 'Do nothing otherwise. 
 Case Else 
 End Select 
 'If the user presses Cancel... 
 Else 
 End If 
 End With 
 
End Sub

See Also

Concepts

FileDialog Object

FileDialog Object Members