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
'===================================================