Karl wrote:
Using Len(Dir$(txtFileName)) to check if a file exists, can anyone
suggest an additional step to check the Read-Only status of the same
file?
Function GetAttr(PathName As String) As VbFileAttribute
VbFileAttributes are:
vbNormal
vbReadOnly
vbHidden
vbSystem
vbVolume
vbDirectory
vbArchive
These are all bit values and can be or-ed safely.
This is an OLD function I have used to check for file existence:
Public Function DoesFileExist1997(ByVal FilePath As String) As Boolean
Private Const FileNotFoundErrNumber As Long = 53
On Error GoTo DoesFileExist1997Err
GetAttr FilePath
DoesFileExist1997 = True
DoesFileExist1997Exit:
Exit Function
DoesFileExist1997Err:
With Err
If .Number = FileNotFoundErrNumber Then
DoesFileExist1997 = False
Else
MsgBox .Description, vbCritical, "Error Number: " & .Number
End If
End With
Resume DoesFileExist1997Exit
End Function
--
Lyle Fairfield