Hi,
Before I execute some code, I want to see if a certain file has already been opened by my program. Is there a way to check such as If #1 is open then...
Thanks,
Dan
Printable View
Hi,
Before I execute some code, I want to see if a certain file has already been opened by my program. Is there a way to check such as If #1 is open then...
Thanks,
Dan
Try this
Code:Private Sub Command1_Click()
On Error GoTo errhandler
FileCopy "FileName", "Destination"
errhandler:
If Err.Number = 75 Then MsgBox "File already in use"
End Sub
Use FreeFile to detect next free filenumber isntead, and have a variable for each filenumber.
Code:Dim hfile as integer
hfile=Freefile
Open File for binary as hfile
Get #hfile,,variable
Msgbox Lof(hfile)
Close hfile