GETATTR(pathname)

Returns the attributes of a given file or directory (Integer).


pathnameThe full pathname of the file you want to examine (String).

REMARKS
* The "pathname" may include a directory and drive.
* The value returned is a sum of the following values:
* 0 = vbNormal.
* 1 = vbReadOnly.
* 2 = vbHidden.
* 4 = vbSystem. Not available on Macintosh.
* 16 = vbDirectory.
* 32 = vbArchive. Macintosh only.
* 64 = vbAlias. Filename is an alias. Macontosh only.
* The easiest way to find out which attributes are set is to use the AND operator to perform a bitwise comparison of the value and the value of the individual file attribute (result = GetAttr(sFileName) And vbArchive.
* The equivalent .NET function is Microsoft.VisualBasic.FileSystem.GetAttr
* For the Microsoft documentation refer to docs.microsoft.com

If (GetAttr("C:\temp\myfile.docx") = VBA.vbArchive + VBA.vbReadOnly) Then 
If (GetAttr("C:\temp\myfile.docx") = 32) Then

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top