How to: Display a Dialog Box to Open Excel Files

The following code prompts users to open a new workbook in Microsoft Office Excel. It sets properties to allow multi-selection, clears the list of available filters, and adds two new filters. The code then calls the Execute method of the FileDialog object to open the requested files.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2007 and Excel 2010. For more information, see Features Available by Office Application and Project Type.


With Me.Application.FileDialog(Microsoft.Office.Core.MsoFileDialogType.msoFileDialogOpen)

    .AllowMultiSelect = True
    .Filters.Add("Excel Files", "*.xls;*.xlw")
    .Filters.Add("All Files", "*.*")

    If .Show = True Then
    End If
End With
Microsoft.Office.Core.FileDialog fd = 

fd.AllowMultiSelect = true; 
fd.Filters.Add("Excel Files", "*.xls;*.xlw", missing); 
fd.Filters.Add("All Files", "*.*", missing); 

if (fd.Show() != 0)

See Also


How to: List Recently Used Workbook Files

How to: Open Workbooks

How to: Activate Workbooks


Working with Workbooks

Optional Parameters in Office Solutions