Code:
Dim fso As Scripting.FileSystemObject
Dim fol As Scripting.Folder
Dim fdr As Scripting.Folder
Dim fil As Scripting.File
Dim flc As Scripting.Folders
Const conInputDirectory As String = "G:\OUT\EmailTest\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fol = fso.GetFolder(conInputDirectory)
Set flc = fol.SubFolders
For Each fdr In flc
fdr.Delete
Next fdr
Set fso = Nothing
Set fol = Nothing
Set flc = Nothing
The above code works for the mapped drive G:, but fails with error 13 - type mismatch for local drive C:\OUT\EmailTest\, with or without the final backslash character; the path exists exactly as used in the GetFolder method. I get the same error when I try fso.DeleteFile, and combinations of Kill/RmDir. Using XP SP2 with Access XP (2002 - not by choice). I have full admin rights to my local and mapped drives. Code is called in the same sub for both addresses by a command button click event.
Anything glaringly obvious I'm missing? Help......
"Time flies like an arrow; fruit flies like a banana."