Filter

Returns or sets the filters that are displayed in the Type list box of a dialog box.

Syntax

object.Filter [= description1|filter1|description2|filter2…]

The parts of the Filter property syntax are described in the following table.

Part Description
object An object expression that evaluates to an object.
description A string expression describing the type of file.
filter A string expression specifying the filename extension.

Remarks

A filter specifies the type of files that are displayed in the dialog box's file list box. For example, selecting the filter *.txt displays all text files.

Use this property to provide the user with a list of filters that can be selected when the dialog box is displayed.

Use the pipe ( | ) symbol (ASCII 124) to separate the description and filter values. Do not include spaces before or after the pipe symbol, because these spaces will be displayed with the description and filter values.

The following code shows an example of a filter that enables the user to select text files or graphic files that include bitmaps and icons:

Text (*.txt)|*.txt|Pictures (*.bmp;*.ico)|*.bmp;*.ico

When you specify more than one filter for a dialog box, use the FilterIndex property to determine which filter is displayed as the default.

Data Type

String