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:
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...)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
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."




Reply With Quote