|
Other options
Personally, I prefer using the win32 API over system objects. Try the DeleteFile API or even the Kill command. If you use KILL, wrap it with an error trap. If you use the API, the return value is non-zero for successful delete. Make sure to add the API declaration to one of your modules though.
'in the declares of a module:
Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
'Then call it like:
dim retVal as long
retVal = DeleteFile(fullFileName)
'then check retVal.
or use the Kill command:
on error resume next
Kill fullFileName
on error goto 0
'then check error state or check if file still exists
My 2 cents. Hope it helps.
|