Table of contents
TOC
Collapse the table of content
Expand the table of content

FileDialogFilter.Extensions Property (Office)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Gets a value containing the extensions that determine which files are displayed in a file dialog box for each Filter object. Read-only.

Syntax

expression. Extensions

expression An expression that returns a FileDialogFilter object.

Return Value

String

Example

The following example displays the extensions and descriptions for Microsoft Excel files by iterating through the filter in the SaveAs dialog box.

Sub Main() 

 'Declare a variable as a FileDialogFilters collection. 
 Dim fdfs As FileDialogFilters 

 'Declare a variable as a FileDialogFilter object. 
 Dim fdf As FileDialogFilter 

 'Set the FileDialogFilters collection variable to 
 'the FileDialogFilters collection of the SaveAs dialog box. 
 Set fdfs = Application.FileDialog(msoFileDialogSaveAs).Filters 

 'Iterate through the description and extensions of each 
 'default filter in the SaveAs dialog box. 
 For Each fdf In fdfs 

 'Display the description of filters that include 
 'Microsoft Excel files. 
 If InStr(1, fdf.Extensions, "xls", vbTextCompare) > 0 Then 
 MsgBox "Description of filter: " & fdf.Description 
 End If 
 Next fdf 
End Sub

See also

Concepts

FileDialogFilter Object

Other resources

FileDialogFilter Object Members

© 2018 Microsoft