DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to check a file is opened or not ?

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    How to check a file is opened or not ?

    [Originally posted by bond]

    how to check a file eg a word file is opening ??
    thx for your reply

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:How to check a file is opened or not ?

    [Originally posted by John Citizen]

    Here is a generic function from my library that i use to see if a file exists. It also will tell you if a file is opened. This is because if you try and open a file and it is already open... you get an error.

    Paste this function in your code and it will return a true if the file is not opened and a false if the file is opened.

    Function DoesFileExist(rsFilename As String) As Boolean

    Dim nFile As Integer

    On Error GoTo err_DoesFileExist

    nFile = FreeFile
    Open rsFilename For Input As #nFile
    DoesFileExist = True

    exit_DoesFileExist:
    Close nFile
    Exit Function

    err_DoesFileExist:
    DoesFileExist = False
    Resume exit_DoesFileExist

    End Function

    Jaie deMaagd
    Neocom IT
    www.neocomit.com.au

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center