Private Declare Function GetFileAttributes Lib "kernel32.dll" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
Function GetFileLength(ByVal sPathFile As String) As Long
Const INVALID_FILE_ATTRIBUTES As Long = &HFFFFFFFF
If GetFileAttributes(sPathFile) = INVALID_FILE_ATTRIBUTES Then
GetFileLength = -1
Else
GetFileLength = FileLen(sPathFile)
End If
End Function