hello
i want to find whether a folder exists or not
how can i do
please help me
Printable View
hello
i want to find whether a folder exists or not
how can i do
please help me
try this :
VB Code:
Option Explicit Private Sub Form_Load() Dim myFolder As String myFolder = Dir$("C:\SampleFolder\") If myFolder = "" Then MsgBox "Folder does not exist!" ElseIf myFolder <> "" Then MsgBox "Folder Exist!" End If End Sub
the above code is working but
it is working if the folder contains any file
otherwise the
function is returning empty string
the i am not able to verify
can u help me
That should work even if the dir has no files in it, since you're explicitly looking for the dir.VB Code:
If Dir$("c:\somedir", vbDirectory) <> "" Then 'directory exists Else 'directory doesn't exist End If