LibreOffice 25.2 ヘルプ
ボリュームやディレクトリの名前ないしファイルのタイプを示すビットパターン情報を取得して返します。
GetAttr (Text As String)
整数
Text: ファイルの位置を明示的に指定した文字列表式。またURL 指定を用いることもできます。
この関数は、指定ファイルの属性を取得して、下記のファイル属性を示すビットパターンを返します。
| Named constant | 値 | 意味 | 
|---|---|---|
| ATTR_NORMAL | 0 | Normal files. | 
| ATTR_READONLY | 1 | Read-only files. | 
| ATTR_HIDDEN | 2 | Hidden file | 
| ATTR_SYSTEM | 4 | システムファイル | 
| ATTR_VOLUME | 8 | Returns the name of the volume | 
| ATTR_DIRECTORY | 16 | Returns the name of the directory only. | 
| ATTR_ARCHIVE | 32 | File was changed since last backup (Archive bit). | 
属性バイトの特定ビットがセットされているかは、下記のような処理で確認できます。
Sub ExampleSetGetAttr
On Error Goto ErrorHandler REM エラーハンドラー用ターゲットを設定
 If Dir("C:\test",16)="" Then MkDir "C:\test"
 If Dir("C:\test\autoexec.sav")="" Then FileCopy "c:\autoexec.bat", "c:\test\autoexec.sav"
 SetAttr "c:\test\autoexec.sav" ,0
 FileCopy "c:\autoexec.bat", "c:\test\autoexec.sav"
 SetAttr "c:\test\autoexec.sav" ,1
 Print GetAttr( "c:\test\autoexec.sav" )
 End
ErrorHandler:
 Print Error
 End
End Sub