Check for Read-Only File Attribute:   Return to List

Const READONLY = &H1
Private Declare Function GetFileAttributes Lib "kernel32.dll" Alias _
    "GetFileAttributesA" (ByVal lpFileName As String) As Long

Private Function CheckIfReadOnly(ByVal FilePathAndName as String) as Boolean
    attr = GetFileAttributes(FilePathAndName)
    If (attr And &H1) = &H1 Then
    CheckIfReadOnly = True
    Else
    CheckIfReadOnly = False
    End If
End Function



Note to Webmaster