FileName

This property returns and sets the path and file name of a selected file.

Syntax

object.FileName [ = pathname]

Parameters

object
Object expression that evaluates to a CommonDialog control.
pathname
String expression that specifies the path and file name.

Remarks

In the CommonDialog control, you can set the FileName property before opening a dialog box to set an initial file name. Reading this property returns the currently selected file name from the list. If you do not select a file, FileName returns a zero-length string.

When you set this property, you can select the file by including the name of an existing file, without wildcard characters, in the string.