-
Dir
Hello,
I keep forggeting this..
if i want my program to look for a directory called 'docs', that exist in the path of the app (app.path), and i want the program to tell this:
if the dirextory exist then go on, else if it exist but empty do some stuff or if it doesn't exist recreate it.
How do i do it?
i keep getting the DIR function all wrong and i can't find out what i intended..
thanks..
-
Code:
Private Sub Command1_Click()
Dim stFile As String, stDir As String
stDir = App.Path & "\docs\"
stFile = Dir$(stDir & "*.*") 'all files
If Dir(stDir, vbDirectory) <> "" Then
'if the dir exists
If stFile = "" Then
'no files in dir so do something
MsgBox "No Files"
Else
'whatever
MsgBox "Files"
End If
End If
End Sub