GetFilePath$ Function
Syntax
GetFilePath[$]([DefName$], [DefExt$], [DefDir$], _[Title$], [Option])
Group
Description
Displays a dialog and get a file path from the user. The returned string is a complete path and file name. If the cancel button is pressed, a null string is returned.
Sandbox
Sandbox mode blocks this function.
Parameters
| Parameters | Description |
|---|---|
| DefName$ | Sets the initial File Name in the to this string value. If this is omitted, *.DefExt$ is used. |
| DefExt$ | Initially shows files whose extension matches this string value.
(Multiple extensions can be specified by using a semicolon (;) as the separator.)
If this is omitted, an asterisk (*) is used.
A filter can be specified using description|*.ext|. You can use multiple descriptions by repeating this format. For example, Bitmap files|*.bmp|PNG files|*.png|JPEG files|*.jpg. |
| DefDir$ | This string value is the initial directory. If this is omitted, the current directory is used. |
| Title$ | This string value is the title of the dialog. If this is omitted, Get File Path is used. |
| Option | This numeric value determines the file selection options. If this is omitted, zero is used. See the table below. |
| Option | Effect |
|---|---|
| 0 | Only allows the user to select a file that exists. |
| 1 | Confirms creation when the user selects a file that does not exist. |
| 2 | Allows the user to select any file whether it exists or not. |
| 3 | Confirms overwrite when the user selects a file that exists. |
| +4 | Selecting a different directory changes the application current directory. |
Example
Sub Main Debug.Print GetFilePath$() End Sub