Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (44 sloc) 1.71 KB
title keywords f1_keywords ms.prod api_name ms.assetid ms.date localization_priority
Application.FileDialog property (Excel)
vbaxl10.chm133270
vbaxl10.chm133270
excel
Excel.Application.FileDialog
96a6fdc5-1bde-68dd-2493-9d8a92915afb
04/04/2019
Priority

Application.FileDialog property (Excel)

Returns a FileDialog object representing an instance of the file dialog.

Syntax

expression.FileDialog (fileDialogType)

expression A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
fileDialogType Required MsoFileDialogType The type of file dialog.

Remarks

MsoFileDialogType can be one of these constants:

  • msoFileDialogFilePicker. Allows user to select a file.
  • msoFileDialogFolderPicker. Allows user to select a folder.
  • msoFileDialogOpen. Allows user to open a file.
  • msoFileDialogSaveAs. Allows user to save a file.

Example

In this example, Microsoft Excel opens the file dialog allowing the user to select one or more files. After these files are selected, Excel displays the path for each file in a separate message.

Sub UseFileDialogOpen() 
 
    Dim lngCount As Long 
 
    ' Open the file dialog 
    With Application.FileDialog(msoFileDialogOpen) 
        .AllowMultiSelect = True 
        .Show 
 
        ' Display paths of each file selected 
        For lngCount = 1 To .SelectedItems.Count 
            MsgBox .SelectedItems(lngCount) 
        Next lngCount 
 
    End With 
 
End Sub

[!includeSupport and feedback]

You can’t perform that action at this time.