View Single Post
Old 12-15-2007, 08:21 AM   #5
ClockWorK
Newbie
 
ClockWorK's Avatar
 
Join Date: Oct 2003
Location: Michigan
Posts: 40
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.
ClockWorK is offline   Reply With Quote