记得以前贴过了...
'检查档案存在
Public Function IsFileExist(strFileName As String) As Boolean
Dim varFSO As Variant, TempString As String
Set varFSO = CreateObject("Scripting.FileSystemObject")
IsFileExist = varFSO.FileExists(strFileName)
Set varFSO = Nothing
End Function
'检查资料夹存在
Public Function IsFolderExist(strFolderName As String) As Boolean
Dim varFSO As Variant, TempString As String
Set varFSO = CreateObject("Scripting.FileSystemObject")
IsFolderExist = varFSO.FolderExists(strFolderName)
Set varFSO = Nothing
End Function
'新增资料夹
Public Function CreateFolder(strFolderName As String) As Variant
Dim varFSO As Variant, TempString As String
Set varFSO = CreateObject("Scripting.FileSystemObject")
varFSO.CreateFolder strFolderName
Set varFSO = Nothing
End Function
'删除资料夹
Public Function DeleteFolder(strFolderName As String) As Variant
Dim varFSO As Variant, TempString As String
Set varFSO = CreateObject("Scripting.FileSystemObject")
varFSO.DeleteFolder strFolderName
Set varFSO = Nothing
End Function