SetAttr

Set the attributes of a file.

Syntax
      SetAttr path, attributes

Key
   path       The path to the file/folder.

  attributes  The file attributes to set.

Available file attributes:

VBConstant Value Description
vbNormal 0 Normal
vbReadOnly 1 Read-only
vbHidden 2 Hidden
vbSystem 4 System file
vbDirectory 16 Directory or folder
vbArchive 32 File has been changed since last backup
vbAlias 64 File name is an alias

The SetAttr() function can be used in VBA.

Examples

'Set a file as Read-Only and Hidden:
SetAttr "C:\docs\demo.doc", vbReadOnly + vbHidden

“False face must hide what the false heart doth know” ~ William Shakespeare

Related

GetAttr - Get file/folder attributes


 
Copyright © 1999-2024 SS64.com
Some rights reserved