FileDialog.Flags Property

 FileDialog.Flags  (read-write, FileDialogFlags)
 
A set of bit flags that determines the state of the dialog, and which may be set or cleared when the dialog returns. See the documentation for more info.

Syntax

FileDialog.Flags [= FileDialogFlags]

The property syntax has these parts:

Part Description
Value (FileDialogFlags) A set of bit flags that determines the state of the dialog, and which may be set or cleared when the dialog returns. See the documentation for more info.

Remarks

This property is typically set to some combination of the flag values in the table below. The numeric values are given in the second table. To combine values, simply add them together, for example (fdFileMustExist + fdNoNetworkButton). After calling the ShowOpen() or ShowSave() method, additional flags may be set or cleared, indicating some additional info about the user's interaction with the dialog. For example, the fdExtensionDifferent flag may be set on return from a dialog method. To check these bits, mask the Flags property with the bit value using the "bitwise AND" operator of your language. For example, in JScript, (dlg.Flags & fdExtensionDifferent != 0) would be true if this bit is set, else false.

Using fdAllowMultiSelect

The fdAllowMultiSelect flag permits the user to select more than one file. If the user does select more than one file, the FileName property returns the path to the current directory followed by the file names of the selected files. The directory and file name strings are separated by null characters, with an extra null character after the last file name. To use this feature, you need to split the FileName string at the null characters. In VBScript or JScript, use the split() function, specifying the null character to split on. In VBScript, the null character is Chr(0), and in JScript, it is \000.

Symbolic Constants

The (symbolic) values for FileDialogFlags are:

Constant Value Description
fdAllowMultiSelect 512 Specifies that the File Namelist box allows multiple selections
fdCreatePrompt 8192 Specifies that the dialog box prompts the user to create a file that doesn't currently exist. This flag automatically sets the cdlOFNPathMustExist and cdlOFNFileMustExist flags.
fdExtensionDifferent 1024 Indicates that the extension of the returned filename is different from the extension specified by the DefaultExt property. This flag isn't set if the DefaultExt property is Null, if the extensions match, or if the file has no extension.
fdFileMustExist 4096 Specifies that the user can enter only names of existing files in the File Name text box. If this flag is set and the user enters an invalid filename, a warning is displayed. This flag automatically sets the cdlOFNPathMustExist flag.
fdHideReadOnly 4 Specifies that the Read Onlycheck box will not appear in the dialog
fdNoChangeDir 8 Forces the dialog box to set the current directory to what it was when the dialog box was opened.
fdNoDereferenceLinks 1048576 Do not dereference shell links (also known as shortcuts). By default, choosing a shell link causes it to be dereferenced by the shell.
fdNoNetworkButton 131072 Specifies that the network button will not appear on the dialog, making it impossible to specify files on other machines in the local network
fdNoReadOnlyReturn 32768 Specifies that the returned file won't have the Read Only attribute set and won't be in a write-protected directory.
fdNoTestFileCreate 65536 Specifies that a test file will not be created to check writeability of the file
fdOverwritePrompt 2 Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.
fdPathMustExist 2048 Specifies that the user can enter only valid paths. If this flag is set and the user enters an invalid path, a warning message is displayed.
fdReadOnly 1 Causes the Read Only check box to be initially checked when the dialog box is created. This flag also indicates the state of the Read Only check box when the dialog box is closed.