I have used the script off the KB on tek-tips but when I run the script it deletes all files and subfolders but not the main folder and gives an error "run-time '76' Path not found
Script:
Sub DeleteFolder(strNewDir)
' ***********************************************************
' *** This will delete a folder even if it contains files ***
' *** Use With Caution ***
' ***********************************************************
Dim fso
'Dim fol As String
Set fso = CreateObject("Scripting.FileSystemObject"
If fso.FolderExists(strNewDir) Then
fso.DeleteFolder strNewDir
Else
MsgBox strNewDir & " does not exist or has already been deleted!" _
, vbExclamation, "Folder not Found"
End If
End Sub
(strNewDir = "C:\CD240104\"
Script:
Sub DeleteFolder(strNewDir)
' ***********************************************************
' *** This will delete a folder even if it contains files ***
' *** Use With Caution ***
' ***********************************************************
Dim fso
'Dim fol As String
Set fso = CreateObject("Scripting.FileSystemObject"
If fso.FolderExists(strNewDir) Then
fso.DeleteFolder strNewDir
Else
MsgBox strNewDir & " does not exist or has already been deleted!" _
, vbExclamation, "Folder not Found"
End If
End Sub
(strNewDir = "C:\CD240104\"