Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Rani Singh   on Nov 25 In MS Office Category.

  
Question Answered By: Benjamin Simpson   on Nov 25

It's probably best to back off your final solution and do a little testing
first. The FSO FolderDelete method takes no prisoners and will err out
gracefully if there's an issue. So let's see if a couple tests with the
FSO method's for handling Exists and Delete:
So let's run it locally first and let's change the structure to a single
subroutine just to make sure all is working as we expect:
'===================================================
Set fso = CreateObject("Scripting.FileSystemObject")

WIP = "C:\windows\temp\~wqn\"
If (fso.FolderExists(WIP)) Then
fso.DeleteFolder(WIP, TRUE)
If Err <> 0 Then
msg=Err.Number & ", " & _
Err.Description & ": " & WIP
Err.Clear
Else
msg="Folder " & WIP & " deleted."
End If
Else
msg = fldr & " doesn't exist."
End If
'Check the Immediate window for the result
Debug.Print = msg
'===================================================

Share: 

 
 
Didn't find what you were looking for? Find more on Deleting folder does not work Or get search suggestion and latest updates.


Tagged: