Attribute VB_Name = "ModFileExist"

Public Function FileExist(ByVal FileName As String) As Long     '文件是否存在(DIR方法)

On Error GoTo 10

If Len(Dir(FileName)) > 4 Then

    FileExist = 1
    
    Exit Function
    
Else

    FileExist = 0
    
    Exit Function
    
End If

10

FileExist = -1

End Function

'Function FileExist(FileName As String) As Boolean       '文件是否存在(FSO方法)
'                                        '需要引用Microsoft Scripting Runtime
'Dim Fso As New FileSystemObject
'
'If Fso.FileExists(FileName) = True Then
'
'    FileExist = True
'
'Else
'
'    FileExist = False
'
'End If
'
'Set Fso = Nothing
'
'End Function

