Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile TheFile, True
What if it had meant Delete parent and all subfolders?I was using the mapped drive letter, as part of the complete filespec in a string variable, but no Kill.
Eventually I succeeded with
Although I don't know what the "true" does.Code:Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFile TheFile, True
BTW Del from command prompt did work.
Sub killfile()
Dim f As String
f = "D:\filename.txt"
On Error GoTo fail
Kill f
MsgBox "file deleted: " & f
Exit Sub
fail:
MsgBox "Error: " & Err & " Description: " & Err.Description
End Sub
With all due respect, I'm suggesting that's not possible. There must have been something else you didn't notice about the file that changed between you trying Kill and FSO. OR, that changed about your network connectivity.KIll failed (in Access), DEL from command prompt (and FSO in Access) worked.
How do you know?The file wasn't read only or Open or locked
Gemma it was error 75, not 70 or 53, and complaining about a (perfectly good) path.,