Tag Archives: directory exists

How to Check if Directory Exist in Visual Basic 6.0

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

This shows how to use VB 6.0 to check whether or not a directory exists.

'Visual Basic 6.0 and VB 5.0
Dim f As String

f = "C:\WINDOWS"
dirFolder = Dir(f, vbDirectory)
If dirFolder <> "" Then
    MsgBox(“This folder already exists.”, vbCritical) 

    'directory exists action here
End If