Be the first user to complete this post

  • 0
Add to List

FileSystemObject : DeleteFolder Method

Description: 

This function Deletes a Folder.

Format : 

objectOfFileSystemObject. DeleteFolder ( folderspec[, force] )

Arguments: 
  • objectOfFileSystemObjectAs the names says, it’s a FileSystemObject.
  • folderspec
    • Mandatory
    • Type:     String
    • Folder name to be deleted.
  • Force
    • Optional
    • Type: Boolean ( True: force deleted even if the folder is in read-only attribute, False (default): not deleted if in read-only attribute.
Function FnDeleteFolder(strCompleteFolderPath)
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set objFolder = fso. DeleteFolder(strCompleteFolderPath)
End Function

Call FnDeleteFolder ("c:\New Folder")



Also Read:

  1. FileSystemObject : DriveExists Method
  2. FileSystemObject : GetFileVersion Method
  3. Excel-VBA : Insert Multiple Images from a Folder to Excel Cells
  4. FileSystemObject : FileExists Method
  5. FileSystemObject : CreateTextFile Method