[RESOLVED] Check for a file in app directory
Hi guys,
Does anyone know how to make it so when a user presses a command button it checks to see if there is a file for example "file.exe" in the same folder as the application and if the file is in their (file.exe) then it will load form 2. But if the file aint fount it gives them a msgbox "File.exe was not found please download file.exe before continuing"
thanks
Re: Check for a file in app directory
Here is an example. Modify it to suit your individual needs
vb Code:
If Dir$("c:\autoexec.bat") <> vbNullString Then
MsgBox "file exists"
Else
MsgBox "file doesn't exist"
End If
End Sub
Re: Check for a file in app directory
vb Code:
Sub Sample()
Dim FlName As String
'~~> Replace with Relevant File name
FlName = Dir(App.Path & "MyFile.Exe")
If (FlName) <> "" Then
'~~> File is there
Form2.Load
Else
'~~> File is not there
MsgBox "File Doesn't Exist"
End If
End Sub
Edit: Ah! Hack beat me to it...
Re: Check for a file in app directory
Awesome!!
Thanks guys, Really appreciate it!
All the best,