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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.