Oct 28, 2002 #1 tleducq Programmer Oct 2, 2002 6 FI Hi, Is there a way to know with VB if a file is opened or not and to control the possibility to open it or not? Thanks, Thomas
Hi, Is there a way to know with VB if a file is opened or not and to control the possibility to open it or not? Thanks, Thomas
Oct 28, 2002 #2 rpmcq Programmer Aug 5, 2001 1 US Function IsFileOpen(ByVal tFile As String) As Boolean On Error GoTo IsOpen Dim fFile As Integer fFile = FreeFile() Open tFile For Input Lock Read Write As fFile Close fFile Exit Function IsOpen: Resume Leave Exit Function Leave: On Error Resume Next IsFileOpen = True End Function Upvote 0 Downvote
Function IsFileOpen(ByVal tFile As String) As Boolean On Error GoTo IsOpen Dim fFile As Integer fFile = FreeFile() Open tFile For Input Lock Read Write As fFile Close fFile Exit Function IsOpen: Resume Leave Exit Function Leave: On Error Resume Next IsFileOpen = True End Function
Oct 30, 2002 Thread starter #3 tleducq Programmer Oct 2, 2002 6 FI thanks, i am gonna try that! Thomas Upvote 0 Downvote