Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Display a Dialog Box to Open Excel Files


Some code examples in this topic use the this or Me keyword or the Globals class in a way that is specific to document-level customizations, or they rely on features of document-level customizations such as host controls. These examples can be compiled only if you have the required applications installed. For more information, see Features Available by Product Combination.

The following code prompts users to open a new workbook in Microsoft Office Excel 2003 and then 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 file(s):


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

Community Additions

© 2015 Microsoft