Oct 28, 2002 #1 tleducq Programmer Joined Oct 2, 2002 Messages 6 Location 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 Joined Aug 5, 2001 Messages 1 Location 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 Joined Oct 2, 2002 Messages 6 Location FI thanks, i am gonna try that! Thomas Upvote 0 Downvote