|
-
Dec 22nd, 2006, 04:07 AM
#1
Thread Starter
Addicted Member
If File Exists
Hi,
I want to make a script that checks that all the required files are where before starting the application.
I was to write something like:
If App.Path & "\config.ini" does not exist THEN
MsgBox "Error"
End If
Any ideas?
Thanks!
-
Dec 22nd, 2006, 04:15 AM
#2
Hyperactive Member
Re: If File Exists
You mean something like this?
VB Code:
Private Sub Command1_Click()
On Error GoTo ErrH
Open "c:\anyfile.txt" For Input As #1
'Anything here
Close #1
Exit Sub
ErrH:
If Err.Number = 53 Then MsgBox "File not found!"
End Sub
-
Dec 22nd, 2006, 04:21 AM
#3
Thread Starter
Addicted Member
-
Dec 22nd, 2006, 04:50 AM
#4
Re: If File Exists
You can check the file's existance using the Dir() command...the example would be
VB Code:
If Dir(App.Path & "\config.ini", vbNormal) = "" Then
MsgBox "File does not Exists"
End If
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|