Results 1 to 7 of 7

Thread: [RESOLVED] Check to see if multiple files exist

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2010
    Posts
    23

    Resolved [RESOLVED] Check to see if multiple files exist

    I want to check if all the files needed for my program exist where they should but I'm having some trouble doing so. Here's the code I'm using:

    Code:
    Private Sub Form_Load()
    
    Dim FileName(4) As String
    
    FileName(0) = "file.bmp"
    FileName(1) = "file2.bmp"
    FileName(2) = "file3.bmp"
    FileName(3) = "file4.bmp"
    
    strPath = App.Path & "/files/"
    For i = 0 To 3
        If Dir$(strPath) <> FileName(i) Then
            CheckPath = True
            Else
            CheckPath = False
        End If
    Next
    If CheckPath = True Then
        frmMain.Show
    Else
        MsgBox "One or more files are missing."
    End If
    End Sub
    I've also tried a different method and it didn't work (listing all the file names in an if statement ( If Dir$(strPath) <> File or Dir$(strPath) <> File2...)

    It should tell the user if a file (doesn't have to specify) is missing so if file2 and file3 exist, but file1 doesn't, it should say "One or more files are missing."
    Last edited by Night_; Jan 2nd, 2011 at 05:59 PM.

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