|
-
Oct 18th, 2000, 07:17 PM
#1
Thread Starter
New Member
I've ready many articles and tutorials, all the same, about how to open and close files. And how to use file boxes to browse for files.
What I wan't to do is be able to check if a directory or file already exists, but without user intervention. An example would be a batch file command like "IF EXIST blah.txt THEN dowhatever"
Is there something like I could use if VB?
-
Oct 18th, 2000, 07:24 PM
#2
You can use the Dir Function to check if a file exist.
Code:
Private Sub Command1_Click()
If Dir("C:\test.txt") = "" Then
MsgBox "File dont exist"
Else
MsgBox "File Exist"
End If
End Sub
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Oct 18th, 2000, 08:23 PM
#3
To check if a directory exists, also using the Dir function:
Code:
Private Sub Command1_Click()
If Dir("C:\MyFolder", vbDirectory) <> "" Then
MsgBox "Folder exists"
Else
MsgBox "Folder does not exist"
End If
End Sub
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
|