Results 1 to 3 of 3

Thread: Checking if a file exists in a folder

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Ont, Canada, Earth
    Posts
    458
    Hi,
    How can I check if file exists in my app's directory?
    Thanks.
    Thanks

    Tomexx.

  2. #2
    Guest
    Use the Dir$ function.
    Code:
    If Dir$("MyFile.txt") <> "" Then
        Print "File exsist"
    Else
        Print "File does not exsist"
    End If

  3. #3
    Lively Member
    Join Date
    Jun 2000
    Posts
    80
    Though it might be overkill, you can use the FileExists method of the File System Object.

    First declare a reference to the Microsoft Scripting Runtime Library.

    Code:
       Dim fso As New FileSystemObject
       Dim bFileExists as Boolean
    
       bFileExists = fso.FileExists(App.Path & "\MyFile.txt")
       
       Set fso = Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width