Partager via


Application.FileDialog Property (Word)

Returns a FileDialog object which represents a single instance of a file dialog box.

Syntax

expression .FileDialog(FileDialogType)

expression Required. A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

FileDialogType

Required

MsoFileDialogType

The type of dialog.

Example

This example displays the Save As dialog box.

Sub ShowSaveAsDialog() 
 Dim dlgSaveAs As FileDialog 
 Set dlgSaveAs = Application.FileDialog( _ 
 FileDialogType:=msoFileDialogSaveAs) 
 dlgSaveAs.Show 
End Sub

This example displays the Open dialog box and allows a user to select multiple files to open.

Sub ShowFileDialog() 
 Dim dlgOpen As FileDialog 
 Set dlgOpen = Application.FileDialog( _ 
 FileDialogType:=msoFileDialogOpen) 
 With dlgOpen 
 .AllowMultiSelect = True 
 .Show 
 End With 
End Sub

See Also

Concepts

Application Object

Application Object Members