Flags

Returns or sets the options for a Color, Font, Open, or Save As dialog box.

Syntax

object.Flags [= value]

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

Part Description
object An object expression that evaluates to an object.
value A constant or value specifying the options for a Color, Font, Open, or Save As dialog box.

Settings

The value settings for the Color dialog box are described in the following table.

Setting Description
&H2 Entire dialog box is displayed, including the Define Custom Colors section.
&H4 Disables the Define Custom Colors command button and prevents the user from defining custom colors.
&H1 Sets the initial color value for the dialog box.

The value settings for the Open and Save As dialog boxes are described in the following table.

Setting Description
&H2000 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.
&H400 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. This flag value can be checked upon closing the dialog box.
&H1000 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.
&H4 Hides the Read Only check box.
&H200000 Use long filenames.
&H8 Forces the dialog box to set the current directory to what it was when the dialog box was opened.
&H100000 Do not dereference shell links (also known as shortcuts). By default, choosing a shell link causes it to be dereferenced by the shell.
&H40000 No long file names.
&H2 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.
&H800 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.

Remarks

You can also define selected flags. Use the Const keyword in the Declarations section of the startup form to define the flags you want to use.

You can set more than one flag for a dialog box using the Or operator. For example:

CommonDialog1.Flags = &H10 Or &H200

Adding the desired constant values produces the same results. The following is equivalent to the preceding example:

CommonDialog1.Flags = &H210 

Data Type

Long