
File not Found / File already open
Hi,
I'm trying to do the following in Visual Basic.
I open a file, do some processing, close the file and then try to
delete the file. (See code below)
iFile = FreeFile
Open sFileName For Binary Access Read As #iFile
lFileLen = LOF(iFile)
....
Close #iFile
'DoEvents
Kill sFileName
'Set oSys = CreateObject("Scripting.FileSystemObject")
'oSys.DeleteFile sFileName, True
'Set oSys = Nothing
When I try to delete the file with the Kill statement, the following
error is raised:
Err Number: 55. Err Desc: File already open.
I've also tried deleting the file with the FileSystemObject, but I get
the following error:
Err Number: 53. Err Desc: File not found
Can anyone help?
Thanks