Skip to content

Make Folder (Create Directory) in Access VBA


Function MakeFolder(strPath As String)
    On Error GoTo MakeFolder_Err
    If Dir(strPath, vbDirectory) > vbNullString Then
        Exit Function
    End If
    MkDir strPath
    MakeFolder = True
    Exit Function
MakeFolder_Err:
    MsgBox "Folder """ & strPath & """ cannot be created."
    MakeFolder = False
End Function

This function creates a directory given a full path string. Note that the enclosing directory needs to exist for this to work. If the directory already exists, the function has no effect.

5
Your rating: None Average: 5 (1 vote)

Comments

Thank you!!!!!!

March 17, 2010 by Anonymous, 19 weeks 2 days ago
Comment id: 4

Thank you!!!!!!

AdaptiveThemes