6 replies
by bmckeehan
add this line first:
On error resume next
backup the file before doing this:
open for output as #1
now if there is an error, then you know the file is being used. I think the same works with:
open for input as #1
the error message will be similar to "File already open". check the error codes and see which error number the message corresponds to.
Now add:
If Err = number% then msgbox "File in use"
make number% equal to the error code.
by bmckeehan
by salexru2000
I would not test at all. Better to use available error detection techniques after you acess file.
In older VB versions it will be like
on error resume next
...
access file statement
if err.number<>0 then
-- here you can analyse the exact cause and do whetever you want
endif
If you need same in VB.Net - use try-catch blocks - for me it was always working perfectly.
Hope this helps
Rgds
by bmckeehan
by bmckeehan
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending