Delete file by using FileSystemObject : FileSystemObject « File Path « VBA / Excel / Access / Word






Delete file by using FileSystemObject

 
Sub cmdDelete()
    Dim myFileSystemObject As FileSystemObject

    Set myFileSystemObject = New FileSystemObject
    myFileSystemObject.DeleteFolder "c:\yourFolder"
    myFileSystemObject.DeleteFile "c:\yourFile"
    Set myFileSystemObject = Nothing
End Sub

 








Related examples in the same category

1.Copying a File
2.Display selected file information
3.Delete Folder by using FileSystemObject
4.Recursive Search using the FileSystemObject Model
5.Listing files with a For...Each loop