'判断文件是否存在
Function ReportFileStatus(filespec)
Dim fso, msg
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(filespec)) Then
msg = filespec & " 存在。"
Else
msg = filespec & " 不存在。"
End If
ReportFileStatus = msg
End Function
'判断文件夹是否存在
Function ReportFolderStatus(fldr) As Integer
Dim fso, msg
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(fldr)) Then
msg = fldr & " 存在。"
Else
msg = fldr & " 不存在。"
End If
ReportFolderStatus = msg
End Function
Private Function FolderExist(FolderName) As Boolean
On Error GoTo ErrHandler
If Dir(FolderName, vbDirectory) <> "" Then
If Dir(FolderName) <> "" Then
If Len(FolderName) = 3 Or Len(FolderName = 2) Then
FolderExist = True
End If
Else
FolderExist = True
End If
End If
Exit Function
ErrHandler:
FolderExist = False
End Function