FileName

Returns or sets the path and filename of a selected file.

Syntax

object.FileName [ = pathname]

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

Part Description
object An object expression that evaluates to an object.
value A string expression that specifies the path and filename.

Remarks

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

When setting this property, you can include the name of an existing file (without wildcard characters) in the string to select the file.