FileDialog Property

Microsoft Word Visual Basic

Show All

FileDialog Property

       

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

expression.FileDialog(FileDialogType)

expression   Required. An expression that returns one of the objects in the Applies To list.

FileDialogType  Required MsoFileDialogType. The type of dialog.

MsoFileDialogType can be one of these MsoFileDialogType constants.
msoFileDialogFilePicker
msoFileDialogFolderPicker
msoFileDialogOpen
msoFileDialogSaveAs

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