SetAttr Statement

Sets attribute information for a file.

Syntax

SetAttr pathname, attributes

The SetAttr statement syntax has these named arguments:

Part Description
pathname Required. String expression that specifies a file name - may include directory or folder, and drive.
attributes Required. Constant or numeric expression, setting file attributes.

Values

Below are possible values of the attributes argument:

Constant Value Description
cdbNormal 0 Normal.
cdbHidden 2 Hidden.
cdbSystem 4 System (only in Microsoft Windows)
cdbArchive 32 File was changed since last backup (only in Microsoft Windows)
cdbAlias 64

The filename is an alias (only on the Macintosh).


Примечание. These constants are defined in the application. This means that their names can be used anywhere in your code in place of the actual values.

Example

In this example the SetAttr statement is used to set attribute information for a file.

' Sets the Hidden attribute.
SetAttr "TESTFILE", vbHidden

' Sets Hidden and Read Only attributes.
SetAttr "TESTFILE", vbHidden + vbReadOnly

See Also

FileAttr Function, GetAttr Function