1.复制文件到指定文件夹
FileCopy path & Range("D" & j) & ".msg", newPath & Range("D" & j) & ".msg"
2.复制文件夹到指定文件夹
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFolder ThisWorkbook.Path & "\测试新建文件夹", ThisWorkbook.Path & "\2011年报表\"
Set fso = Nothing
3.删除指定文件夹
If FileFolderExists(path) And Len(path) <> 0 Then
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFolder path, True
Set fs = Nothing
End If
4.判断指定文件或者文件夹是否存在
Public Function FileFolderExists(strFullPath As String) As Boolean
On Error GoTo EarlyExit
If Not Dir(strFullPath, vbDirectory) = vbNullString Then FileFolderExists = True
EarlyExit:
On Error GoTo 0
End Function