'获取文件属性的API Private Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long Const FILE_ATTRIBUTE_DIRECTORY = &H10 Public Function fileExists(ByVal PathN As String) As Boolean PathN = Trim(PathN) If PathN = "" Then Exit Function Dim r As Long r = GetFileAttributes(PathN) fileExists = (r > 0) And (r <> FILE_ATTRIBUTE_DIRECTORY) End FunctionPublic Function DirectoryExists(ByVal PathN As String) As Boolean PathN = Trim(PathN) If PathN = "" Then Exit Function Dim r As Long r = GetFileAttributes(PathN) DirectoryExists = (r > 0) And (r = FILE_ATTRIBUTE_DIRECTORY) End Function
Private Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
Const FILE_ATTRIBUTE_DIRECTORY = &H10
Public Function fileExists(ByVal PathN As String) As Boolean
PathN = Trim(PathN)
If PathN = "" Then Exit Function
Dim r As Long
r = GetFileAttributes(PathN)
fileExists = (r > 0) And (r <> FILE_ATTRIBUTE_DIRECTORY)
End FunctionPublic Function DirectoryExists(ByVal PathN As String) As Boolean
PathN = Trim(PathN)
If PathN = "" Then Exit Function
Dim r As Long
r = GetFileAttributes(PathN)
DirectoryExists = (r > 0) And (r = FILE_ATTRIBUTE_DIRECTORY)
End Function
debug.print f.Files.Count