Ajuda del LibreOffice 25.2
Retorna el mode d'accés o el número d'accés de fitxer d'un fitxer que es va obrir amb l'expressió Open. El número d'accés del fitxer depèn del sistema operatiu (OSH = Operating System Handle).
If you use a 32-Bit operating system, you cannot use the FileAttr function to determine the file access number.
Vegeu també: Obri
  FileAttr (Channel As Integer, Attributes As Integer)
Enter
Channel: The number of the file that was opened with the Open statement.
Attributes: Integer expression that indicates the type of file information that you want to return. The following values are possible:
1: FileAttr indicates the access mode of the file.
2: FileAttr returns the file access number of the operating system.
Si especifiqueu un atribut de paràmetre amb un valor d'1, s'apliquen els valors de retorn següents:
1 - INPUT (fitxer obert per entrada)
2 - OUTPUT (fitxer obert per eixida)
4 - RANDOM (fitxer obert per accés aleatori)
8 - APPEND (fitxer obert per ser afegit)
32 - BINARY (fitxer obert en mode binari).
Sub ExampleFileAttr
    Dim iNumber As Integer
    Dim sLine As String
    Dim aFile As String
    aFile = "C:\Users\ThisUser\data.txt"
    iNumber = Freefile
    Open aFile For Output As #iNumber
    Print #iNumber, "Això és una línia de text"
    MsgBox FileAttr(#iNumber, 1), 0, "Access mode"
    MsgBox FileAttr(#iNumber, 2), 0, "File attribute"
    Close #iNumber
End Sub