1个回答
展开全部
Private Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA" (ByVal pszPath As String) As Long
'-----------------------判断文件与文件夹是否存在函数
Public Function FiFoExists(ByVal FileName As String) As Boolean
If FileName <> "" Then FiFoExists = CBool(PathFileExists(FileName))
End Function
'-----------------------判断文件是否存在函数
Public Function FileExists(ByVal FileName As String) As Boolean
If FileName <> "" Then TempBol = CBool(PathFileExists(FileName))
If TempBol Then FileExists = Not FolderOrFile(FileName)
End Function
'-----------------------判断文件夹是否存在函数
Public Function FolderExists(ByVal FileName As String) As Boolean
If FileName <> "" Then TempBol = CBool(PathFileExists(FileName))
If TempBol Then FolderExists = FolderOrFile(FileName)
End Function
'-----------------------判断一个路径是文件夹还是文件
Public Function FolderOrFile(strPath As String) As Boolean
If GetAttr(strPath) And vbDirectory Then FolderOrFile = True Else FolderOrFile = False
End Function
'-----------------------判断文件与文件夹是否存在函数
Public Function FiFoExists(ByVal FileName As String) As Boolean
If FileName <> "" Then FiFoExists = CBool(PathFileExists(FileName))
End Function
'-----------------------判断文件是否存在函数
Public Function FileExists(ByVal FileName As String) As Boolean
If FileName <> "" Then TempBol = CBool(PathFileExists(FileName))
If TempBol Then FileExists = Not FolderOrFile(FileName)
End Function
'-----------------------判断文件夹是否存在函数
Public Function FolderExists(ByVal FileName As String) As Boolean
If FileName <> "" Then TempBol = CBool(PathFileExists(FileName))
If TempBol Then FolderExists = FolderOrFile(FileName)
End Function
'-----------------------判断一个路径是文件夹还是文件
Public Function FolderOrFile(strPath As String) As Boolean
If GetAttr(strPath) And vbDirectory Then FolderOrFile = True Else FolderOrFile = False
End Function
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询