|
本帖最后由 鱼儿游游 于 2011-10-14 15:00 编辑
'功能描述: 判断一个文件夹是否已存在
'
'输入参数: strPathName 必需的,文件夹的路径名
'返回参数: 文件夹存在时返回True,不存在或路径名无效时返回Flase
Public Function IsFolderExists(ByVal strPathName As String) As Boolean
On Error GoTo Err_Handler
If strPathName <> "" Then
If (GetAttr(strPathName) And vbDirectory) <> 0 Then IsFolderExists = True
End If
If Len(strPathName) > 2 And Mid$(strPathName, 3, 1) <> "\" Then IsFolderExists = False
Exit_Handler:
Exit Function
Err_Handler:
IsFolderExists = False
Resume Exit_Handler
End Function |
|